Question

I am trying to get username[eg: Joe Richard] and his/her comment from one Facebook page. There are a lot of comments[200+]. I have tried to get html code with this code

string urlAddress = tbLink.Text;

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlAddress);
        HttpWebResponse response = (HttpWebResponse)request.GetResponse();
        if (response.StatusCode == HttpStatusCode.OK)
        {
            Stream receiveStream = response.GetResponseStream();
            StreamReader readStream = null;
            if (response.CharacterSet == null)
                readStream = new StreamReader(receiveStream);
            else
                readStream = new StreamReader(receiveStream, Encoding.GetEncoding(response.CharacterSet));
            string data = readStream.ReadToEnd();

            lResult.Text = data;

            response.Close();
            readStream.Close();
        }

I thought I would get string and get comments I want. But in this way I could not get all comments. Could you suggest some better ways? Maybe I should use some specific Facebook library?

Was it helpful?

Solution

Here is the .Net SDK I have used in two projects: http://facebooksdk.net/
You can use this SDK along with FQL to query desired data from Facebook tables.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top