Asked  7 Months ago    Answers:  5   Viewed   45 times

Now I posting a single photo to wall like this:

$response = $facebook->api("/$group_id/photos", "POST", array(
    'access_token=' => $access_token,
    'message' => 'This is a test message',
    'url' => '',

It works fine, but can I somehow post a multiple photos, something like this:

enter image description here



You can make batch requests as mentioned here:

But its simple to loop through your images and publish them directly.

foreach($photos as $photo)
       //publish photo


(regarding grouping of photos on wall)

This grouping is done by facebook automatically if some photos are uploaded into the same album.

Currently you cannot create an album in a group via Graph API - it is not supported (as of now), see this bug.

But you can do this - create an album manually, then get the album_id by-
GET /{group-id}/albums, then use the the code with album_id instead of group_id-

foreach($photos as $photo){
   $facebook->api("/{album-id}/photos", "POST", array(
      'access_token=' => $access_token,
      'name' => 'This is a test message',
      'url' => $photo

I've tested it, see the result-

enter image description here

Wednesday, March 31, 2021
answered 7 Months ago

The path you are using /406221796071956/photos is wrong and that's why it does not work.

The reason that this path is wrong, is that 406221796071956 is the id of a picture, see for yourself, the Graph API Explorer for 406221796071956 says:

"type": "photo"

If you want to publish to that album then use /196878530339618/photos, since it's the album: Graph API Explorer for 196878530339618

"type": "album"


Please refer to for adding photos to an album.

2nd Edit

According to the documentation of the Album object:


Determines whether the UID can upload to the album and returns true if the user owns the album, the album is not full, and the app can add photos to the album

So you need the album not to be full, to be the owner of the album and have the right permissions for uploading.

Wednesday, March 31, 2021
answered 7 Months ago

Figured out the problem. I had a typo... I was assigning the url to $logoutUrl and was trying to get the url from $logout_url...


Wednesday, March 31, 2021
answered 7 Months ago
ini_set('memory_limit', "9999M");

function fetchUrl($url) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_TIMEOUT, 40);
    $data = curl_exec($ch);
    return $data;

$url_array = array();

function recurse_it($url, $c) {
    global $url_array;
    $feeds         = fetchUrl($url);
    $feed_data_obj = json_decode($feeds, true);
    if (!empty($feed_data_obj['data'])) {
        $next_url      = $feed_data_obj['paging']['next'];
        $url_array[$c] = $next_url;
        recurse_it($next_url, $c + 1);
    return $url_array;

$url = "";
$arr = recurse_it($url, 0);

Where $arr is an array of all the available pagination links for which I used a foreach to loop through all the contents of the pagination.

Sunday, August 8, 2021
answered 3 Months ago

I've verified using the Graph API explorer that the pagination is not working as you have described. Log it as a bug with Facebook at: and post the bug # here.


Per the bug closure, the 100 limit is By Design and you won't get more than that, meaning that Facebook has made a conscious business decision to limit the amount of data it has to store, process, and serve from the Graph API. It costs money to do so and since the API is free to use, I can't argue with them. However, if I was paying for it, then hell yes I kick and scream all the way down the road.

Saturday, August 14, 2021
answered 3 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :