首先请求许可:
if(!$data["user_id"]) {
$app_id = "175403625997298";
$redirect_url = urlencode("https://www.facebook.com/szalagavatoszeged/app_175403625997298?app_data=haho");
$scope = "publish_stream";
$auth_url = "https://www.facebook.com/dialog/oauth?client_id=" . $app_id . "&redirect_uri=" . $redirect_url . "&scope=" . $scope;
echo("<script> top.location.href='" . $auth_url . "'</script>");
$login_url=$facebook->getLoginUrl($scope);
fb_publish();
}
检查我在链接中给出的论点后:
if($szavazott=='haho'){
header('Location: szavazott.php');
}
并发布:
try {
$ret_obj = $facebook->api('/me/feed', 'POST',
array('link' => 'https://www.facebook.com/szalagavatoszeged/app_175403625997298','message' => 'Posting with the PHP SDK!',));
print 'haha';
} catch(FacebookApiException $e) {
}
但是这段代码没有发布:S有什么问题吗?