Hi i am in the process of learning c# and i am trying to develop a simple web search gui program that lists a list of products from a text entered by the user in a textbox. my ginnie pig is scan.co.uk
whats the best way to get the specific content i need from a html webpage that generates the search results from within scan ie http://www.scan.co.uk/Search.aspx?q=9800
here is the code i have done so far. i store the scan html source code for the above link on a String. not good?
Code:public void connect() { Console.WriteLine("About to make a connection to the server"); Console.WriteLine("URL = " + scanURL + search[0]); try { HttpWebRequest request = (HttpWebRequest)WebRequest.Create(scanURL+search[0]); HttpWebResponse response = (HttpWebResponse)request.GetResponse(); Console.WriteLine("Response =" + response); if (response.StatusCode == HttpStatusCode.OK) { TextReader reader = new StreamReader(response.GetResponseStream()); webPage = reader.ReadToEnd(); Console.WriteLine("webpage =" + webPage); } } catch(Exception e) { Console.WriteLine("Error = " +e); } }


LinkBack URL
About LinkBacks

Reply With Quote

