我需要使用PHP SDK(Facebook)获取专辑封面照片.
我试着用:
https://graph.facebook.com/[ALBUM_ID]/picture?type=album,但我得到一个默认图片…例如…获取用户https://graph.facebook.com/的个人资料照片[USER_ID] /照片?类型=方
谢谢.
解决方法:
您可以使用FQL,这是我的首选方法,并提供了很大的灵活性.此代码示例应该是您需要的:
$album_id = '6464156415616';
try{
$fql = 'SELECT pid, src_small FROM photo WHERE pid in (SELECT cover_pid FROM album WHERE aid='.$album_id.' AND owner=me())';
$param = array(
'method' => 'fql.query',
'query' => $fql,
'callback' => ''
//,'return_ssl_resources'=>1 //set this option if you want the source to come from https
);
$fqlResult = $facebook->api($param);
$fqlResult['type'] = $uploadVal['type'];
//fetch values
$src_small = $fqlResult['src_small'];
} catch(Exception $o){
print_r($o);
}
您可以在此处找到对所有FQL表的引用:http://developers.facebook.com/docs/reference/fql/