www.yell.com,from,c#" /> Acess www.yell.com from c# - Problems and solutions to issues related to Microsoft : OS, Applications, Development, Hardware, Server, Internet Protocols, Database, Exchange .

Question : Acess www.yell.com from c#

Hi

Is it possible to pass a search criteria into www.yell.com and capture the results in a C# program. E.g. Enter "Local Government" in "Surrey" and then capture the names, addresses, phone no.s etc returned.

Thanks

Answer : Acess www.yell.com from c#

Below is the code for request type get
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
HttpWebRequest req;
            HttpWebResponse resp;
            Stream st;
            StreamReader sr;
            string empid;
            // TextBox2.Text = buffer;
            int index = 0, rindex, tindex, groupIndex;
            bool found = false;

            req = (HttpWebRequest)WebRequest.Create("http://www.yell.com/ucs/UcsSearchAction.do?keywords=local+government&companyName=&location=surrey&scrambleSeed=64445904&searchType=advance&M=&bandedclarifyResults=&ssm=1&autocomplete=kwlo");
            resp = (HttpWebResponse)req.GetResponse();
            st = resp.GetResponseStream();
            sr = new StreamReader(st);
            string buffer = sr.ReadToEnd();

the buffer contains the response on the page as html

you have to parse the HTML using regular expression for the required result.
Random Solutions  
 
programming4us programming4us