1

我有一个有效的页面访问令牌,我正在尝试将图片发布到相册(此相册:https ://www.facebook.com/media/set/?set=a.333031973457854.77237.323448221082896&type= 3)相册然后 ID 是:333031973457854.77237.323448221082896 但我收到此错误:OAuthException:(#803)您请求的某些别名不存在:33303197345785477237323448221082896(<--正如您看到的专辑ID)谁能指导我通过我所拥有的做错了,我应该如何解决?谢谢 :) 这是我的代码:

    <?php
$fbconfig['appid' ]    = "172098812914132";
$fbconfig['secret']    = "XXXXXXXXXXXXXXXXX";
$fbconfig['pageid']    = "323448221082896";
$fbconfig['token1']    = "XXXXXXXXXXXXXXXX";
$fbconfig['token2']    = "XXXXXXXXXXXX";
$fbconfig['my_ulr']    = 'http://'.$_SERVER['SERVER_NAME'];
$albumid = '33303197345785477237323448221082896';
require_once('../scripts/facebook.php');
$facebook = new Facebook(array(
  'appId'  => $fbconfig['appid'],
  'secret' => $fbconfig['secret'],
));

$pageid = $fbconfig['pageid'];
$imagesDir = 'images/';
$images = glob($imagesDir . '*.{jpg,jpeg,png,gif,JPG,JPEG,PNG,GIF}', GLOB_BRACE);
$randomImage = $images[array_rand($images)];
printf("Trying to upload: " . $randomImage . "\n"); // The path to the random image.
try
{
  //  $page_info = $facebook->api("/$pageid?fields=access_token");  
// Album ID 33303197345785477237323448221082896
$args = array(
    'access_token'  => $fbconfig['token2'],
    'source' => 'www.gorillalol.com/i/' . $randomImage,
    );          
    $post_id = $facebook->api("/" . $albumid . "/photos","post",$args);
    unlink($randomImage); // Deletes the file, so it can't get reposted.
    printf("Successful Image Upload :)");
} 
catch (FacebookApiException $e)
{
    printf("Failed. :p");
    printf($e);
}
?>
4

1 回答 1

0

@MathieuImbert 是对的。您需要的部分是第一个整数。

一旦更正,您可能会得到一个空的结果。您还忘记了请求publish_stream许可。

此处的官方示例:https ://developers.facebook.com/blog/post/498/ (在您的情况下为场景 2)。

更多信息在这里:https ://stackoverflow.com/a/3006901/1515819

于 2013-03-02T22:37:22.807 回答