How do I can post a multiple photos via Facebook API

前端 未结 5 1962
难免孤独
难免孤独 2020-11-29 10:26

Now I posting a single photo to wall like this:

$response = $facebook->api(\"/$group_id/photos\", \"POST\", array(
    \'access_token=\' => $access_to         


        
5条回答
  •  夕颜
    夕颜 (楼主)
    2020-11-29 11:09

    You can now publish multiple images in a single post to your feed or page:

    For each photo in the story, upload it unpublished using the {user-id}/photos endpoint with the argument published=false.

    You'll get an ID for each photo you upload like this:

    {
      "id": "10153677042736789"
    }
    

    Publish a multi-photo story using the {user-id}/feed endpoint and using the ids returned by uploading a photo

     $response = $facebook->api("/me/feed", 'POST',
      array(
        'access_token=' => $access_token,
        'message' => 'Testing multi-photo post!',
        'attached_media[0]' => '{"media_fbid":"1002088839996"}',
        'attached_media[1]' => '{"media_fbid":"1002088840149"}'
      )
    );
    

    Source: Publishing a multi-photo story

提交回复
热议问题