0
我沒有很好的編碼技能,我想要做的是當我用戶訪問我的網站,並在他授予訪問我的應用程序消息後將張貼到他的牆和我希望他被重定向到的牆後工作正常一些其他的url,但之後他授予權限沒有任何反應只有白色頁面顯示這是代碼我有:PHP sdk重定向後,他已授予權限
<?php
require_once "./src/facebook.php";
$app_id = "xxxxxx";
$app_secret = "xxxxx";
// Init facebook api.
$facebook = new Facebook(array(
'appId' => $app_id,
'secret' => $app_secret,
'cookie' => true
));
// Get the url to redirect for login to facebook
// and request permission to write on the user's wall.
$login_url = $facebook->getLoginUrl(
array('scope' => 'publish_stream')
);
$loginUrl = $facebook->getLoginUrl($params);
// If not authenticated, redirect to the facebook login dialog.
// The $login_url will take care of redirecting back to us
// after successful login.
if (! $facebook->getUser()) {
echo <<< EOT
<script type="text/javascript">
top.location.href = "$login_url";
</script>;
EOT;
exit;
}
// Do the wall post.
$facebook->api("/me/feed", "post", array(
message => "test",
picture => "http://s.ytimg.com/yt/img/doodles/teachers_day_yoodle-vflBKh2mG.png",
link => "http://www.youtube.com/",
name => "test",
caption => "test"
));
?>
你從哪裏得到$ params?它看起來像你從不同的地方複製粘貼的代碼片段 檢查Facebook的文檔。這裏也有一些例子 – dythffvrb