0
我想設置一個Facebook的PHP的帖子到牆上,但在Facebook身份驗證後,代碼只是不斷重定向與不同的令牌,任何人都可以幫助我嗎?非常感謝!!Facebook的身份驗證不斷重定向
這裏是我的樣本網址:http://for-winner.com/fff.php
require_once ("fb/src/facebook.php");
$facebook = new Facebook(array(
'appId' => 'id',
'secret' => 'secret',
'cookie' => true
));
$attachment = array(
'message' => 'hello',
);
$user = $facebook->getUser();
if($user == 0) {
$login_url = $facebook->getLoginUrl($params = array('scope' => "publish_stream"));
echo ("<script> top.location.href='".$login_url."'</script>");
} else { $token=$facebook->getAccessToken();
try {
$ret_obj = $facebook->api('/me/feed', 'POST', $attachment);
} catch(FacebookApiException $e) {
$login_url = $facebook->getLoginUrl(array(
'scope' => 'publish_stream'
));
error_log($e->getType());
error_log($e->getMessage());
}
}