phpfacebookfacebook-graph-apifacebook-php-sdkfacebook-group

Facebook API Search - Search for Groups?


I have been testing the Facebook php sdk. I am able to search for pages & places but not groups. According to the documentation, this should return groups...

https://graph.facebook.com/search?q=programming&type=group

The below code works. If I change the type from "page" to "group", the code fails. I do not get an exception:

$query = urlencode('Harlem');

$type = 'page';


$results = $facebook->api('/search?q='.$query.'&type='.$type);

Solution

  • It depends on what kind of Access Token you're using. As of https://developers.facebook.com/docs/reference/api/search/#access_tokens searches for pages require an App Access Token, whereas searches for Groups require an User Access Token. Please check accordingly.