【问题标题】:OAuthException when trying to upload/post photos to group尝试将照片上传/发布到组时出现 OAuthException
【发布时间】:2013-11-01 04:02:13
【问题描述】:

我目前正在尝试通过应用将照片上传到页面和群组。我有这些代码:

try
{
    $facebook->setFileUploadSupport(true);
    $args = array('message' => 'This is my image caption',); 
    $args['image'] = '@'.realpath('./uploads/terragarden1.png');
    $response = $facebook->api('/GROUP_ID/photos/','POST',$args);
}
catch(FacebookApiException $e)
{
     echo "Error: ".$e; 
}

$args['image'] 的值是这样的:

@/home/publica/public_html/AutoPost/uploads/terragarden1.png

问题是它会抛出一个OAuthException: An unknown error has occurred. 我不太清楚如何处理这种错误。

补充:
当我尝试使用相同的代码发布图片并且只是更改时
$response = $facebook->api('/GROUP_ID/photos/','POST',$args);

进入$response = $facebook->api('/me/photos/','POST',$args);,图片将成功发布在用户的墙上。这里可能有什么问题?

【问题讨论】:

    标签: facebook-graph-api facebook-php-sdk photo-upload


    【解决方案1】:

    这在页面上对我来说很好:

    $attachements = array(                                  
            'access_token' => $page->getToken(),
            'message' => $post_pub['title'],
            'url' => 'http://site.com/images/your_image.png' );                             
            try{
               $result = $facebook->api('/'.$page->getIdFacebook().'/photos', 'POST', $attachements, function(){
               }); 
            }
            catch(Exception $e){ }
    

    可能想尝试从“图片”切换到“网址”

    【讨论】:

      【解决方案2】:

      我遇到了同样的问题。

      这里有个话题:https://developers.facebook.com/bugs/1430985030446221?browse=external_tasks_search_results_527428908614f7c36099745

      我曾尝试使用 js sdk 执行此操作,但错误响应相同。

      【讨论】:

      • 是的,在我寻求解决方案的过程中,我也订阅了它。目前其状态已更改为已修复,但我的应用仍然显示 OAuthException: An unknown error has occurred.
      猜你喜欢
      • 2017-07-22
      • 2012-09-12
      • 1970-01-01
      • 2023-03-04
      • 1970-01-01
      • 2012-05-14
      • 2016-08-12
      • 2016-12-31
      • 1970-01-01
      相关资源
      最近更新 更多