0
我正在研究一個小應用程序,讓用戶從他的臉書專輯中選擇一張照片,最好從個人資料或封面專輯。
我正在使用下面的代碼。 測試網址http://babysoftblog.com/megapicture/albums.phpFQL和臉書專輯和圖像
<?php
$app_id = 'XXXXX';
$app_secret = 'XXXXX';
$my_url = 'http://babysoftblog.com/megapicture/albums.php';
$code = $_REQUEST["code"];
// auth user
if(empty($code)) {
$dialog_url = 'https://www.facebook.com/dialog/oauth/?client_id='.$app_id.'&redirect_uri='.urlencode($my_url).'&scope=user_photos';
echo("<script>top.location.href='" . $dialog_url . "'</script>");
}
//get user access_token
$token_url = 'https://graph.facebook.com/oauth/access_token?client_id='
. $app_id . '&redirect_uri=' . urlencode($my_url)
. '&client_secret=' . $app_secret
. '&code=' . $code;
try {
$access_token = file_get_contents(@$token_url);
}
catch (Exception $e)
{ echo "OOPs look like something went wrong"; }
//$fql_query_url = 'https://graph.facebook.com/'.'fql?q=SELECT+pid,src_small+FROM+photo+WHERE+aid+IN+(SELECT+aid+FROM+album+WHERE+owner=+me())&'.$access_token;
try{
$fql_query_url = 'https://graph.facebook.com/'.'fql?q=SELECT+aid,name+FROM+album+WHERE+owner=+me()&'.$access_token;
$fql_query_result = file_get_contents($fql_query_url);
$fql_query_obj = json_decode($fql_query_result, true);
}
catch (Exception $e)
{ echo "oops something went wrong"; }
?>
但隨着當我刷新頁面上面的代碼..它提供了異常,請在這裏看到 http://babysoftblog.com/megapicture/albums.php ,我怎麼可以直接選擇配置文件和相冊封面照片。
請在此幫助我,在此先感謝。