【发布时间】:2011-06-12 20:16:53
【问题描述】:
我使用这种方法来获取 facebook api 数据。只是一个搜索查询。但我发现在curl 时间内使用curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 会花费更多时间(超过10 秒以上)。
还有其他的curl方法可以跑得更快吗?
注意:我现在在 localhost 进行测试
$url = "https://graph.facebook.com/search?access_token=".$token."&q=dallas&type=post&scope=publish_stream,offline_access,user_status,read_stream";
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 2);
//curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__). '/file.crt'); the way as Lumbendil recommend, download a crt file via firefox. still slowly.
$body= curl_exec($ch);
curl_close ($ch);
PS:我不想使用SDK,因为我在本地主机测试中设置SDK 失败。虽然我已经阅读了很多关于如何在 localhost 中设置的文章。我已将http://127.0.0.1/facebook 设置为我的回调网址。但只是失败了。所以我还是想得到一个简单的卷曲方式。
谢谢。
【问题讨论】: