gpt4 book ai didi

php - 获取未捕获的 OAuthException : An unknown error has occurred on photo post to target album

转载 作者:行者123 更新时间:2023-12-02 22:30:19 25 4
gpt4 key购买 nike

$photo_details = array(
'message'=> $image->description().' '.$site_adr.$image->id().'/'.cleanSEOstring(strtolower(trim($image->title()))).'-cover-photo',
'redirect_uri'=> 'http://www.exampleurl.com',
'scope'=>'publish_stream');
$photo_details['image'] = '@' . realpath($photo);
try
{
$upload_photo = $facebook->api('/'.$album_uid.'/photos', 'POST', $photo_details);
@unlink($file);
header('location:https://www.facebook.com/profile.php?id='.$userMe['id'].'&v=wall');
}
catch(FacebookApiException $e)
{
header('location:http://www.somethingwentwrong.com');
}

它仍然重定向到 somethingwentwrong.com,我是不是做错了什么?

如标题中所述,异常是“发生未知错误”,这是它在 catch 语句中返回的对象:

object(FacebookApiException)#5 (7) { ["result:protected"]=> array(1) { ["error"]=> array(3) { ["message"]=> string(30) "An unknown error has occurred." ["type"]=> string(14) "OAuthException" ["code"]=> int(1) } } ["message:protected"]=> string(30) "An unknown error has occurred." ["string:private"]=> string(0) "" ["code:protected"]=> int(0) ["file:protected"]=> string(48) "/var/www/mysite/fb-sdk/base_facebook.php" ["line:protected"]=> int(1106) ["trace:private"]=> array(4) { [0]=> array(6) { ["file"]=> string(48) "/var/www/mysite/fb-sdk/base_facebook.php" ["line"]=> int(810) ["function"]=> string(17) "throwAPIException" ["class"]=> string(12) "BaseFacebook" ["type"]=> string(2) "->"

最佳答案

找出异常错误信息是什么。所以做这样的事情:

} catch {
error_log('caught exception: '. $e);
header('location:http://www.somethingwentwrong.com');
}

如果你得到 OAuthException: (#803) Some of the aliases you requested do not exist 然后确保 $album_uid 是一个字符串而不是一个 int。

还要确保用户已授予您的应用 user_photos 权限。异常错误信息会告诉你。

如果您尝试将照片发布到 FB 页面,则需要使用页面访问 token 。

你的代码看起来不错,除了我认为 'scope''redirect_uri' 不会对 Graph API 调用做任何事情。

关于php - 获取未捕获的 OAuthException : An unknown error has occurred on photo post to target album,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12384877/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com