我編寫了這個小腳本,它將默認應用程序相冊中的用戶配置文件(圖像/手持.jpg)上傳到應用程序相冊中(從巫婆調用此腳本的應用程序相冊中)。如何從此FB腳本獲取pid?
現在我有一個問題。 我想獲得剛剛上傳的照片的獨特pid(圖片ID)。 當我嘗試回聲$數據,有這樣一個INT:
120629757986939這似乎是所創建的對象的FBID
:
http://www.facebook.com/photo.php?pid=115842&id= & REF = fbx_album & FBID = 120629757986939
我需要這一個:
.../photo.php PID? = & ID = 100001197451821 & REF = fbx_album & FBID = 120629757986939
有誰知道如何得到這個值? 感謝您的幫助, 卡米洛
下面我所用,以上傳照片的腳本:
$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);
我試過:) Graph API返回「false」。 有沒有教程解釋整個過程? 我真的覺得有點啞,而在此stucking ... 如果有誰知道哪裏個錯誤/什麼應該加入這將是非常apprecited, 感謝您的幫助, WSP – Camillo 2010-08-15 16:38:58
@Camillo沒有什麼錯誤它返回?它不應該只是返回false,必須有一些錯誤信息。 – serg 2010-08-15 16:58:15