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}"));
什么服务器设置已经改变了吗?你不能告诉你的客户重置这个设置吗? – wmk