I want to search for posts(news-feed) using graph API for the past 30 days of data? what is the best practice to do that? And does Facebook Graph API has an API limit to limit the request of HTTP requests?
NOTE: None of the below works anymore. As of version 2.3 of the Facebook Graph API, the search endpoint has been deprecated.
Copying from here under "Searching":
Searching
You can search over all public objects in the social graph with https://graph.facebook.com/search. The format is:
https://graph.facebook.com/search?q=QUERY&type=OBJECT_TYPE
We support search for the following types of objects:
* All public posts: https://graph.facebook.com/search?q=watermelon&type=post * People: https://graph.facebook.com/search?q=mark&type=user * Pages: https://graph.facebook.com/search?q=platform&type=page * Events: https://graph.facebook.com/search?q=conference&type=event * Groups: https://graph.facebook.com/search?q=programming&type=group * Places: https://graph.facebook.com/search?q=coffee&type=place¢er=37.76,122.427&distance=1000 * Checkins: https://graph.facebook.com/search?type=checkin
You can also search an individual user's News Feed, restricted to that user's friends, by adding a q argument to the home connection URL:
* News Feed: https://graph.facebook.com/me/home?q=facebook
That's one way of doing this. But your better bet will be using FQL, which is used by the JavaScript SDK, with the fb.dataquery method. What you want to do is use the stream table to get the status posts for users.
Now, from your question, I understand that you rather use the PHP version over the Javascript Version. As per that, what you need to do is decode (using json_decode
) the json object recevied by this url:
https://graph.facebook.com/[USERNAME/USERID]?fields=posts&access_token=[A VALID ACCESS TOKEN]
As far as I know, this sould have no limit. However, take a look at the docs here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With