Use the Facebook API to search for links in posts

Hey, I was wondering if it is possible to search Facebook using its API for a given URL. I am trying to find how many people mention this link. An example of what I'm trying to achieve is url_info Tweetmeme, but for Facebook. The Tweetmeme API returns an array of data about the given link, for example, the frequency used and the last twitter. If anyone knows an alternative to Facebook, then that would be very appreciated. I am browsing their API but cannot find any solutions.

Thanks in advance Ben

+6
api php search facebook
source share
3 answers

While researching the answer from Vance Lucas, I went through FQL equivilent @ http://developers.facebook.com/docs/reference/fql/link_stat

$facebook->api_client->fql_query('SELECT share_count, like_count, comment_count, total_count FROM link_stat WHERE url="MY_URL"'); 

This FQL record returns "Share Count", "Link Count", "Comment Count" and "Total Count".

+3
source share

I recently hit this hidden gem while creating an SEO tool:

 http://api.facebook.com/restserver.php?method=links.getStats&format=json&urls=http://stackoverflow.com/ 

This is an old API, but you can confirm that the counts have been updated by checking this on the new Graph API, which gives you the total:

 https://graph.facebook.com/?ids=http://stackoverflow.com/ 
+5
source share

Check out the Overview of the Charts API page in the documentation for Facebook developers under the heading โ€œSearch.โ€ It indicates that you can use the Graph API to search for all public messages for a given query:

 https://graph.facebook.com/search?q=<your_url_here>&type=post 

(Be sure to first encode the URL.)

This will result in a JSON array containing references to your URL. It doesn't seem to provide any search metadata, but rather is a broken list of search results, so you have to create the metadata yourself.

0
source share

All Articles