如何使用graph API创建相册并将照片上传到相册?

时间:2018-08-31 13:29:36

标签: laravel facebook-graph-api

我想创建相册并向其上传照片,最后将其发布为带有图形API的页面。这是我的代码:

  public function share_fb(Request $request)
  {
    $fb                = new Facebook();
    $page              = Page::find($request->page_id);
    $page_fb_id        = $page->fb_id;
    $page_access_token = $page->access_token;
    $oAuth2Client      = $fb->getOAuth2Client();
    $fb->setDefaultAccessToken($oAuth2Client->getLongLivedAccessToken($page_access_token)->getValue());
    $post = Post::find($request->post_id);
    //&scheduled_publish_time='.Carbon::parse($post->start).&published=false
    if($post->type == 'album')
    {
        $img = Postmedia::where('post_id',$post->id)->get(['fb_path']);
        $album = $fb->post('/'.$page_fb_id.'/albums?name=album');
        $publish = $fb->post('/'.$album->getGraphNode()['id'].'/photos? 
        message='.$post->description.'&published=false&url='.$img);
    }

      return 'succes';
   }

我得到“((2/2))FacebookResponseException 发生未知错误。“

0 个答案:

没有答案