2011-11-21 16 views
0

最近私はウェブホストを変更しました。それ以来、私はFacebookのユーザーIDのために0を得ています:FacebookのユーザーIDは常に0です

<?php 
$app_id = "xxxxxxxx"; 
$canvas_page = "http://apps.facebook.com/the_rsg/"; 
$auth_url = "http://www.facebook.com/dialog/oauth?client_id=".$app_id."&redirect_uri=".urlencode($canvas_page); 
$signed_request = $_REQUEST["signed_request"]; 

list($encoded_sig, $payload) = explode('.', $signed_request, 2); 

$data = json_decode(base64_decode(strtr($payload, '-_', '+/')), true); 

if (empty($data["user_id"])) { 
    echo("<script> top.location.href='".$auth_url."'</script>"); 
}else{ 
    $pageContent = file_get_contents('http://graph.facebook.com/'.$data["user_id"]); 
    $parsedJson = json_decode($pageContent); 
    $user_id = $parsedJson->id; 
    $user_name = $parsedJson->name; 
    session_start(); 
    $_SESSION['UserID'] = $user_id; 
} 
?> 

どのようにこれを修正できますか?エラーログを確認するには

+0

あなたのFacebookアプリの基本設定が正しく変更されましたか? –

+0

いいえ、キャンバスのURLを変更しました –

+0

残りのデータは正しく返されますか? – JohnP

答えて

1

PHPの警告:のfile_get_contents(http://graph.facebook.com/xxxxx)[function.file-getを-内容]:

を開くことができませんでしたストリーム:適切なラッパーが/home/jay/public_html/index.phpの行20にありません

問題はphp.iniファイルにあります。

解決策はallow_url_fopenを有効にすることです。

関連する問題