
Untitled
By: a guest on
May 6th, 2012 | syntax:
None | size: 1.17 KB | hits: 21 | expires: Never
Posting a photo to facebook page posts to my profile instead
$graph_url = "https://graph.facebook.com/" . $page_id . "?fields=access_token&access_token="
. $params['access_token'];
$post_url = 'https://graph.facebook.com/'. $page_id .'/photos';
function message($data,$token,$url)
{
// need token
$data['access_token'] = $token;
// init
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// execute and close
$return = curl_exec($ch);
curl_close($ch);
// end
return $return;
}
$page_access_token = $params['access_token'];
$post_url = 'https://graph.facebook.com/'. $page_id .'/photos';
print_r($post_url); echo("<br><br>");
print_r($params['access_token']); echo("<br><br>");
//echo( message(array( 'source' => '@que/xjy7M.png' ) , $page_access_token, $post_url ));
echo( message(array( 'source' => '@que/1.jpg') , $page_access_token, $post_url ));
}