本文介绍了将自定义参数传递给Facebook粉丝页面标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法将自定义参数发送到我的Facebook粉丝页面标签。
I'm unable to get custom parameters send to my facebook fan page tab.
我正在使用php,并像下面这样传递:
I'm using php and is passing like this:
{page-name} /?sk = APP_ID& pass = 1
http://www.facebook.com/pages/{page-name}/?sk=APP_ID&pass=1
但我无法读取参数pass
but I'm unable to read the parameter pass
Sreejith
推荐答案
Facebook作为signed_Request数据的一部分传入您的数据。
这是您如何使用PHP检索它:
Facebook passes in your data as part of the signed_Request data.Here is how you would retrieve it using PHP:
<?php
require 'facebook.php';
$app_id = "YOUR APP ID HERE";
$app_secret = "YOUR SECRET KEY HERE";
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
// THE MAGIC SAUCE
$signed_request = $facebook->getSignedRequest();
$page_id = $signed_request["page"]["id"];
$like_status = $signed_request["page"]["liked"];
// HERE IS A STRING OF YOUR APP DATA.
$app_data = $signed_request["app_data"];
echo '$app_data = '.$app_data;
?>
此示例需要Facebook PHP api,并将您的app_data写入浏览器窗口,您可以欣赏到所有的荣耀。
This example requires the Facebook PHP api and will write your app_data into the browser window where you can marvel in all its glory.
这篇关于将自定义参数传递给Facebook粉丝页面标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!