Check if page tab app is still installed

核能气质少年 提交于 2019-12-05 05:52:20

From my testing and according to Facebook's documentation, you don't need a user's access token to check if an app is installed (although you can use it). I found it easier to login as your app. Here's facebook's link that shows you how. Look at the section called "App Login".

In short, you get an app access token with something like this in php:

$access_token = file_get_contents(https://graph.facebook.com/oauth/access_token? client_id=YOUR_APP_ID&client_secret=YOUR_APP_SECRET& grant_type=client_credentials);

Then you can use that access token to get the data tab:

$app_check = json_decode(file_get_contents("https://graph.facebook.com/". FACEBOOK_PAGE_ID . "/tabs/" . YOUR_APP_ID . "?access_token=" . $access_token;));

As you can see, I json decoded the contents of that file and then do a check to see if that app id exists on the page.

if(!empty($app_check->data)){

echo "APP IS INSTALLED"; }else{ echo "APP IS NOT INSTALLED"; }

I hope that helps!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!