2015-06-17 59 views
0

我在過去一週內使用的代碼沒有任何問題。但最近,客戶端改變了服務器設置,我有這個奇怪的問題。我的curl請求現在返回id爲35,並且不會生成身份驗證令牌。我檢查了php_info函數,發現curl已經在服務器上啓用了。我知道這裏的代碼是完美的,因爲它在之前和另一臺服務器上工作完美。有誰知道我應該在服務器-Cpanel中尋找什麼,或者是否需要對代碼進行任何更改?捲曲集返回資源ID 34

function fetchUrl($url) 
{ 
    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL, $url); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    curl_setopt($ch, CURLOPT_TIMEOUT, 20); 
    // You may need to add the line below 
    // curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false); 
    $feedData = curl_exec($ch); 
    curl_close($ch); 
    return $feedData; 
} 

$profile_id = "XXXXXXXXXXXXX"; 

//App Info, needed for Auth 
$app_id = "XXXXXXXXXXXXXXXXXX"; 
$app_secret = "XXXXXXXXXXXXXXXXXXXXX"; 
//Retrieve auth token 
$authToken = fetchUrl("https://graph.facebook.com/oauth/access_token?grant_type=client_credentials&client_id={$app_id}&client_secret={$app_secret}"); 
$json_object = json_decode(fetchUrl("https://graph.facebook.com/{$profile_id}/feed?{$authToken}")); 
+0

什麼服務器設置已經改變了嗎?你不能告訴你的客戶重置這個設置嗎? – wmk

回答

1

集捲曲SSL版本3

curl_setopt($ch, CURLOPT_SSLVERSION,3); 

版本應該工作