尝试使用Facebook PHP SDK,但如果我请求某些权限,应用程序会生成循环重定向,直到出现错误。有人知道为什么吗?遵循代码。感谢。
***<?php
require 'src/facebook.php';
$facebook = new Facebook(array(
'appId' => 'XXXXXXXXXXXXXXXXX',
'secret' => 'XXXXXXXXXXXXXXXXXXXXX',
));
// permitir upload de fotos
$facebook->setFileUploadSupport(true);
$user = $facebook->getUser();
if ($user)
{
$permissions = $facebook->api("/me/permissions");
if (!array_key_exists('publish_stream', $permissions['data'][0])) {
header( "Location: " . $facebook->getLoginUrl(array("scope" => "publish_stream")) );
exit;
}
echo "Pode publicar as fotos";
} else {
$loginUrl = $facebook->getLoginUrl();
header("Location: $loginUrl");
exit;
}***