I can't seem to find the definitive word out there of the facebook search api: the api that allows you to search public status updates and comments/posts (there is a web interface for all logged in users for this at the moment).
4 Answers
You can use the Facebook graph API :
http://developers.facebook.com/docs/reference/api/
look for the searching section,
QUOTE from fb:
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:
-
4Thanks a lot, I have already given up searching for this on their API ref page :)– EllandJul 17, 2012 at 16:34
-
Does using this API require registration of some sort? Or do you just use it just like that , without doing anything special? May 2, 2013 at 9:34
-
@androiddeveloper Yes you need to register your fb application in developers.facebook.com to get your secret key May 2, 2013 at 13:27
-
so it's not quite public, and anytime they wish, they can shut down the service specifically for your app. May 2, 2013 at 13:35
-
3It's not working anymore since April 4th 2018 for: event, group, page, user Apr 12, 2018 at 23:12
Facebook Public Post search is no longer available in Graph API v2.0: https://developers.facebook.com/docs/apps/changelog
-
4User, Page, Event, Group, Place & Checkin search still seem to still work fine in v2.0 w/ the same format as the accepted answer with the /v2.0/ inserted. The Newsfeed - /me/home?q=x endpoint however is also no longer available in addition to Post search, for clarification. Aug 6, 2014 at 13:53
-
-
2
-
That's correct. The API v2 has been deprecated on August 7, 2016 Oct 27, 2016 at 12:19
Better way is using Facebook PHP SDK
-> Search any term using facebook php sdk.
$mySrch = $facebook->api('/search?q=YOUR WORD&type=TYPES');
THERE ARE VARIOUS TYPES, you can search:
- post
- user
- event
- group
- place
- checkin
-
17this is the same answer as above, it's just that the above it more general. also your answer could be considered wrong since the user didn't specify that they want to use php Feb 24, 2013 at 11:41
-
1
The search according to "type=user" type="event" type="group" type="page is deprecated now. See https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#search-4-4