|
string url = "http://domain.com/pageOrService.ashx?qryString=" + someVariable, allData;
WebClient w = new WebClient();
StreamReader sr = new StreamReader(w.OpenRead(url));
allData = sr.ReadToEnd();
sr.Dispose();
From here you can use the MS XML DOM if the html is well formed, or you can use string manipulation, or even a 3rd party component. But depending on what you might want to do with an upstream web service or page ( probably a page unless someone forgot to set up their WSDL ), it could be pretty easy. For example, maybe you just need to know whether the page has a title:
if(!allData.Contains("<title>"))
//Tell the user to get with it
Even if this is an over-simple example, it shows you how to get data by making HTTP GET calls, how to stuff the document that gets sent down into a string variable, and from that, you can do anything with it.
|