TCP Socket Programming

I am writing a C programme to connect to the facebook.
I am confused, how to read specific address like
https://www.facebook.com/rishikantawwww

Please Help me

@rckanta Are you trying to parse the page. Connect and scan for info or? Can you please explain the purpose? What are you trying to accomplish with your program?

1 Like

Just I want to read a specific address of website using C language.

I think error is in this code.
char *response = “GET / HTTP/1.1\n\n”;

@rckanta In this code snipit you will connect and read response then search response for the search word.

string pageContent = null;
HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://example.com/page.html");
HttpWebResponse myres = (HttpWebResponse)myReq.GetResponse();

using (StreamReader sr = new StreamReader(myres.GetResponseStream()))
{
    pageContent = sr.ReadToEnd();
}

if (pageContent.Contains("YourSearchWord"))
{
    //Found It
}
2 Likes