Retrieve Parameter From Page Tab URL

我是研究僧i 提交于 2019-12-06 15:58:17

You need to use the app_data parameter. Facebook would read this parameter and pass it to your app within the request:

In addition, your app will also receive a string parameter called app_data as part of signed_request if an app_data parameter was set in the original query string in the URL your tab is loaded on. It could look like this: "https://www.facebook.com/YourPage?v=app_1234567890&app_data=any_string_here". You can use that to customize the content you render if you control the generation of the link.

On a side note, you can use the PHP-SDK to also get the signed request like this:

$signed_request = $facebook->getSignedRequest();

More here: https://github.com/facebook/facebook-php-sdk/blob/master/src/base_facebook.php#L489

Also you need to check if you actually have a valid user session before calling /me, I suggest you have a look at the PHP-SDK example.

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