-
WebClient Class
Hi,
I have a .net windows application and I need to open a web page (asp page), the page only returns one word at the top left of the page. I need to read the one word it returns within my windows applicaiton code. I understand that I can use the webclient class but do not know which method to use to return the text on the web page.
Thanks for any help,
Chris
-
if the page only displays a small amount of content and your sure it's not likely to change radically you could use a screen scrape and parse the HTML .
OK this is in C# (and it's a bit of hack) but it's what i had handy in my clipboard and you get the idea...
PHP Code:
WebRequest myRequest = WebRequest.Create("http://<some address here>");
WebResponse myResponse = myRequest.GetResponse();
System.IO.StreamReader sr = new System.IO.StreamReader(myResponse.GetResponseStream(),System.Text.Encoding.ASCII,true);
//Just to display - parse the stream where you know your content will appear
MessageBox.Show(sr.ReadToEnd().ToString());
myResponse.Close();