所以基本上我正在为客户端构建一个脚本,在他的页面中用作iframe。它应该做的是当用户喜欢他的页面,然后他可以看到内容,“应用程序”应该自动发布到他的墙上的东西(听起来像垃圾邮件,但我不确定是否有问题)。所以我得到了第一点工作,但为了上帝的爱我不能做第二部分..这是我的代码
<? require 'facebook.php';
$app_id = "my_appid";
$app_secret = "my_secret";
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
$signed_request = $facebook->getSignedRequest();
function parsePageSignedRequest() {
if (isset($_REQUEST['signed_request'])) {
$encoded_sig = null;
$payload = null;
list($encoded_sig, $payload) = explode('.', $_REQUEST['signed_request'], 2);
$sig = base64_decode(strtr($encoded_sig, '-_', '+/'));
$data = json_decode(base64_decode(strtr($payload, '-_', '+/'), true));
return $data;
}
return false;
}
if($signed_request = parsePageSignedRequest()) {
if($signed_request->page->liked) {
echo "This content is for Fans only!";
} else {
echo "Please click on the Like button to view this tab!";
}
}
?>
我尝试在“已登录状态”中添加此内容
$result = $facebook->api( '/me/feed/','post',
array('access_token' => $app_secret,
'message' => 'Playing around with FB Graph..')
);
没有运气,因为我收到错误。如果你能提供帮助,请告诉我。感谢名单