$url= "http://api.stackoverflow.com/1.1/search?tagged=php"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_ENCODING, ""); // this will handle gzip content $result = curl_exec($ch); curl_close($ch); print $result;
错误
Warning: curl_init() has been disabled for security reasons on line 2
Warning: curl_setopt() has been disabled for security reasons on line 3
Warning: curl_setopt() has been disabled for security reasons on line 4
Warning: curl_setopt() has been disabled for security reasons on line 5
Warning: curl_setopt() has been disabled for security reasons on line 6
Warning: curl_exec() has been disabled for security reasons on line 7
Warning: curl_close() has been disabled for security reasons on line 8
我知道为什么我的卷发不起作用吗?
答案 0 :(得分:3)
从您的php.ini中删除disable_functions
上面的上述功能。
答案 1 :(得分:2)
答案 2 :(得分:1)
与您的托管服务商联系!:)
或尝试:
file_get_contents('http://api.stackoverflow.com/1.1/search?tagged=php');
// Most likely it's also blocked.
您也可以尝试使用streams
下载。
或者使用sockets
并直接连接到服务器并发送HTTP请求并自行解析响应。
有很多方法,不知道他们是否可以使用您的设置...如果cURL不可用。
答案 3 :(得分:0)
打开php.ini
文件,然后检查那里的disable_functions
。并查看您的curl_init
是否包装在那里!这是More information