Login  
Search All Forums
Dart Home | PowerTCP Web for ActiveX | Custom Development Reply | PowerTCP Web for ActiveX Topics | Forums   
AuthorForum: PowerTCP Web for ActiveX
Topic: General Usage
MSloper

From: Amityville, NY USA
Posts: 14
Member Since: 05/20/06
posted May 21, 2006 9:51 AM

Ok, so I got my code to work using the PageFetch Sample and using the Post Sample. But, I'm reading through some of the other forum discussions and it appears that in order to submit something to a web site that you fetch, you must determine 'what' to post before you can post it... IOWs (and using a specific example), even though I can fetch the Google main page, I must take the page apart (eg using Ethereal) to determine what Google expects a post to look like before I can post it back to Google. What I can not do, apparently, is fetch the Google page "fill it" and then programmatically "submit" this back to Google (and let the scripts or html in 'the' page figure out what to post back). Is this correct? If not, what can I do? If so, what can I do?
MSloper

From: Amityville, NY USA
Posts: 14
Member Since: 05/20/06
posted May 21, 2006 1:09 PM

Will add to this thread, instead of starting another...
I have an extension to the original question. Note: WRT the Post Code I've written, I've take the minimal steps to create my version of the sample Post App. I've been able to Post data to the DART example .ASP page successfully, no problems. And I've been able to successfully "FETCH" from both Google and Yahoo. But I can not post a simple query to either of them. Is there some Web Tool property that these sites are looking for? Why doesn't the simply posting shown in the sample work for Yahoo and Google?
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted May 22, 2006 8:53 AM

When you say "Post a simple query", please elaborate by giving me an example of something you are doing on google. From what I can see all of their queries are GET's with the parameters passed in as a query string.

MSloper

From: Amityville, NY USA
Posts: 14
Member Since: 05/20/06
posted May 24, 2006 6:16 AM

Yup, you are right these are simple Gets. Bit rusty on my HTML, sorry. 

But this leads to my original and basic question. Must I know -precisely- how the page I'm trying to 'auto-communicate' work? 

IOWs, is it possible for a site to prevent a programmer from 'auto-communicating' with it or will using an Ethereal-like tool after and manually communicating with the site tell me all I need? 

('auto-communicating'==using programmatic methods such as with Darts tools).
Tony Priest



From: Utica, NY USA
Posts: 8466
Member Since: 04/11/00
posted May 24, 2006 8:13 AM

Anything that can be done using a browser can be done using the control. Some things ares more complicated than others, but they can be done. For example, here is some code I wrote that queries google for images and returns a list of the urls. It's using the WebASP control from the Web Enterprise tool, not the Web control, but hopefully it will get you going in the right direction:

private ArrayList GetImageUrlList(string QueryString, int start)
{
ArrayList list = new ArrayList();
string url = "http://images.google.com/images?q=";
url += QueryString;
url += "&imgc=color&imgsz=xxlarge&svnum=1&hl=en&lr=&safe=off&start=" + start.ToString() + "&sa=N";
UriBuilder uri = new UriBuilder(url);

try
{
web.Request.Content = "";
web.Request.Url = uri.ToString();
System.Diagnostics.Debug.WriteLine (web.Request.Url);
web.Get();

if (web.Response.Status != 200)
throw new Exception("Bad Response: [" + web.Response.Status.ToString() + "] " + web.Response.StatusText);

web.Response.Body.FileMode = FileModeConstants.createAlways;
web.Response.Body.FileName = "response.html";

web.Response.Body.Position = 0;
string response = web.Response.Body.ReadString(0);

string token = "<a href=/imgres?imgurl=";
string[] parts = response.Replace(token, "\0").Split('\0');

string s;
foreach(string part in parts)
{
s = part.Trim();
if (s.StartsWith("http://"))
list.Add(ParseUtil.TrimTokenRight(s,"&"));
}
}
catch(Exception ex)
{
ShowError(ex);
}
return list;
}
Reply | PowerTCP Web for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX