我编写了这个小脚本,它将默认应用程序相册中的用户配置文件(图像/手持.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