好的,这一切都很好......除了,照片发布到用户提要,而不是作为页面管理员发布......(它从我的个人 Facebook 帐户发布,而不是作为页面发布)
到处寻找答案,但空无一物......
(config.php)
<?PHP
$facebook = new Facebook(array(
'appId' => $appId,
'secret' => $appSecret,
'fileUpload' => true,
'cookie' => true
));
$fbuser = $facebook->getUser();
?>
<?php
include_once("config.php");
$facebook->setFileUploadSupport(true);
$userPageId = 619143434781602;
if ($fbuser) {
try {
$img = $imgSrc;
$post_url = '/'.$userPageId.'/photos';
$photo = $facebook->api($post_url, 'POST',
array(
'source' => '@' . 'test.jpg',
'message' => 'Photo uploaded via the PHP SDK!'
)
);
} catch (FacebookApiException $e) {
echo $e->getMessage();
}
}
?>