编辑:
<?php
$file= 'fbplus.jpg';
$args = array(
'message' => $album_message,
);
$args[basename($file)] = '@' . realpath($file);
$ch = curl_init();
$url = $graph_url;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $args);
$data = curl_exec($ch);
//returns the photo id
print_r(json_decode($data,true));
echo "$data['id'] "; //wont work
echo "$data[id] "; //wont work
?>
这是我成功上传照片后的回报。
数组([id] => 112235735579158 [post_id] => 100003781972892_112203478915717)