简体   繁体   中英

Get JSON response from facebook api restserver

I want to get the like_count of a page. I tried using PHP SDK, but I've given up on it because my site always stops loading after the line of code where the FQL query is executed, so I wanted to try to get the like count 'manually'.

I tried using file_get_contents() on https://api.facebook.com/restserver.php?method=fql.query&query=QUERY&format=json , but it shows me nothing.

Do you know how I can get the JSON string from the above URL on which I can use json_decode(), or even a better way to get the like count ?

Any help is appreciated.

PS If it means anything, QUERY is SELECT like_count FROM link_stat WHERE url="page_url_here"

您的FQL应该被编码,您可以使用新的URL地址:

https://api.facebook.com/method/fql.query?query=SELECT%20like_count%20FROM%20link_stat%20WHERE%20url%3D%22http%3A%2F%2Fsample.com%22&format=json&access_token=<ACCESS_TOKEN>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM