2012-06-01 58 views
1

自2011年8月以來,我們一直在使用Facebook PHP SDK來做我們的OAuth註冊和驗證。上個月它破裂了。破產我的意思是$ me = $ facebook-> api('/ me'); 調用突然開始返回一個空數組 - 沒有任何錯誤拋出。 幾個月沒有對系統的這部分進行更改。Facebook的PHP SDK停止返回API值

我以此爲契機遷移到v3.1.1,但沒有任何效果。

我們在jsp/Tomcat安裝中運行一個php頁面,所以我們使用了quercus。我將它作爲普通的php運行並獲得相同的結果。

由於我沒有看到提出的一般警告,我認爲它必須是我們網站上的東西,但我無法隔離任何東西。任何想法?這裏是PHP代碼(我們有一個用戶,所以我們在代碼通過身份驗證的模塊 - $我數組包含什麼)

<?php 
$request = quercus_servlet_request(); 
$page = $request->getAttribute("page"); 

include_once 'facebook.php'; 

$facebook = new Facebook(array(
'appId' => $request->getAttribute("appId"), 
'secret' => $request->getAttribute("secretKey"), 
'cookie' => true 
)); 


if(is_null($facebook->getUser())) { 
    $url = $facebook->getLoginUrl(array('next' => $request- >getAttribute("canvasUrl"),'req_perms' => 'publish_stream')); 
    $page->Log("LOGIN URL",$url); 
    echo "<script type='text/javascript'>window.top.location.href = '$url';</script>"; 
    exit; 
} else { 
    try { 
     $page->Log("AUTH","AUTHENTICATED"); 
    $uid = $facebook->getUser(); 
     $me = $facebook->api('/me'); 
     $page->Log("UID",$uid); 
     $page->Log("ME array",print_r($me, true)); 

     $request->getSession()->setAttribute("authenticated","T"); 
     $request->getSession()->setAttribute("fbuid",strval($uid)); 
     $request->getSession()->setAttribute("fname",$me['first_name']); 
     $request->getSession()->setAttribute("lname",$me['last_name']); 
     $request->getSession()->setAttribute("accesstoken",$facebook- >getAccessToken()); 
    //$page->Log("fbuid",$request->getSession()->getAttribute("fbuid")); 

.......

回答

1

現在Facebook是有世界各地的一些停機時間。您可能會看到一些奇怪的問題。

但是你應該考慮測試您的應用程序使用圖形API探險here並確認問題就在你身邊或Facebook enter image description here

選擇在右上角的應用程序和查詢API。

對我來說,它工作得很好(印度)。