Graph API new feed post object-Attachment not showing

前端 未结 4 1002
名媛妹妹
名媛妹妹 2020-12-30 09:26

I\'m having a strange problem with the graph API, the below code used to work for me adding a post to a users news feed with a thumbnail of the attached photo (referenced in

4条回答
  •  时光取名叫无心
    2020-12-30 09:37

    you have to permission pubish_stream on your app and then try this using curl:-

    $attachment =  array(
            'access_token' => $access_token,
            'message' => 'i m success to using graph api for post wall',
            'name' => 'Wall Post using graph api',
            'link' => 'www.mysite.com',
            'description' => 'Using the Graph API, any Facebook users Wall feed may be accessed by using this URL:',
            'picture'=>'http://example.com/images/noimage.png'
     );
    $url = "https://graph.facebook.com/$facebook_id/feed";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $attachment);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  //to suppress the curl output
    $result = curl_exec($ch);
    curl_close ($ch);
    print_r($result)
    

提交回复
热议问题