Joe Rakhimov
Joe Rakhimov

Reputation: 5083

How to get all comments on picture in Facebook

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?

Upvotes: 0

Views: 191

Answers (1)

Ganesh Jadhav
Ganesh Jadhav

Reputation: 2848

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.

Upvotes: 1

Related Questions