douhao2011 2015-06-17 06:15
浏览 60

卷曲集返回资源ID 34

I was using the code below for the past week without any issues. But recently, client changed the server settings and I had this weird issue. My curl request now returns id as 35 and will not generate auth token. I checked php_info function and found that curl is already enabled on the server. I know the code here is perfect since it was working perfectly before and in another server too. Does anyone know what should I look for in server -Cpanel, or is there any changes needed to the code?

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}"));
  • 写回答

1条回答 默认 最新

  • doubo3384 2015-06-17 06:22
    关注

    set the curl SSL version to version 3

    curl_setopt($ch, CURLOPT_SSLVERSION,3);
    

    this should work

    评论

报告相同问题?

悬赏问题

  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥30 python代码,帮调试,帮帮忙吧