Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The first issue I see is that the Batch should not be part of the URL, but rather part of the params ...</p> <p>See the crude batch example below:</p> <pre><code>$batch = array(); $req = array( 'method' =&gt; 'GET', 'relative_url' =&gt; '/me' ); $batch[] = json_encode($req); $req = array( 'method' =&gt; 'GET', 'relative_url' =&gt; '/me/albums' ); $batch[] = json_encode($req); $params = array( 'batch' =&gt; '[' . implode(',',$batch) . ']' ); try { $info = $facebook-&gt;api('/','POST',$params); } catch(FacebookApiException $e) { error_log($e); $info = null; } if(!empty($info)){ if($info[0]['code'] == '200'){ $user_profile = json_decode($info[0]['body']); } if($info[1]['code'] == '200'){ $user_albums = json_decode($info[1]['body']); } echo "&lt;pre&gt;User Profile:\n"; print_r($user_profile); echo "\nAlbums\n"; print_r($user_albums); echo "&lt;pre&gt;"; } </code></pre> <p>Notice specifically how the $facebook->api call is formatted ...</p> <p>EDIT: </p> <p>Here is a working batch picture upload:</p> <pre><code>$files = array( '/data/Pictures/pic1.jpg', '/data/Pictures/pic2.jpg', '/data/Pictures/pic3.jpg' ); //Must set upload support to true $facebook-&gt;setFileUploadSupport(true); $batch = array(); $params = array(); $count = 1; foreach($files as $file){ $req = array( 'method' =&gt; 'POST', 'relative_url' =&gt; '/me/photos', 'attached_files' =&gt; 'file' . $count ); //add this request to the batch ... $batch[] = json_encode($req); //set the filepath for the file to be uploaded $params['file'.$count] = '@' . realpath($file); $count++; } $params['batch'] = '[' . implode(',',$batch) . ']'; try{ $upload = $facebook-&gt;api('/','post',$params); } catch(FacebookApiException $e) { error_log($e); $upload = null; } //View the results ... if(!is_null($upload)){ echo "&lt;pre&gt;" . print_r($upload,1) . "&lt;pre&gt;"; echo "&lt;hr /&gt;"; } </code></pre> <p>Just tested and it works like a charm ...</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload