Batch wall post to multiple Facebook accounts using php
===

I am trying to post status messages to multiple FB users but not while they are on my site. I have publish_stream perms and a 60 day access token for each user I am posting to, but I can't figure out how to batch this correctly. 

Is this the correct way to put in the access token? 

	$body = array(
             	'message' => $message, 
               	'link'    => $link,
              	'picture' => $picture,
             	'name'    => $name,
             	'description'=> $description
          		);
        $batchPost=array();
        $i=1;  		
		foreach ($user_fb_id_array as $fb_id) {
			$batchPost[] = array(
    			'method' => 'POST',
    			'relative_url' => "/" . $fb_id['user_fb_id'] . "/feed?access_token=" . $fb_id['user_fb_auth_code'], // Will this work???
    			'body' => http_build_query($body) );
			if($i++ == 50) {
				try {
					$multiPostResponse = $this->facebook->api('?batch='.urlencode(json_encode($batchPost)), 'POST');
				} catch(FacebookApiException $e) {
                    error_log($e);
                    echo("Batch Post Failed");
                }
                unset($batchPost);
                $i=1;
			}
		}
		
		if(isset($batchPost) && count($batchPost) > 0 ) {
        	try{
            	$multiPostResponse = $this->facebook->api('?batch='.urlencode(json_encode($batchPost)), 'POST');
        	} catch(FacebookApiException $e){
            	error_log($e);
            	echo("Batch Post Failed");
        	}
    	}

To give credit where credit is due, this code was modified from the 25labs.com original code.

