I have coded this little script, which upload a photo (images/hand.jpg) into a users profile in the default application album (in the app-album from witch im calling this script).
Now i have a problem. I would like to get the unique pid (picture id) of the just uploaded photo. When I try to echo $data, there is a int like this:
120629757986939
which appears to be the fbid of the created object:
http://www.facebook.com/photo.php?pid=115842&id=100001197451821&ref=fbx_album&fbid=120629757986939
I need this one:
.../photo.php?pid=115842&id=100001197451821&ref=fbx_album&fbid=120629757986939
Does anyone knows how to get this value? Thanks for all your help, Camillo
Below the script what i am using to upload the photo:
$uid = $facebook->getUser();
$me = $facebook->api('/me');
$token = $session['access_token'];//here I get the token from the $session array
$album_id = $album[0];
//upload your photo
$file= 'images/hand.jpg';
$args = array(
'message' => 'Photo from application',
);
$args[basename($file)] = '@' . realpath($file);
$ch = curl_init();
$url = 'https://graph.facebook.com/'.$album_id.'/photos?access_token='.$token;
$data = post($url, $referer, $agent, $cookie, $args, 1);
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);