【发布时间】:2015-10-09 10:16:08
【问题描述】:
我在这里遇到了这个功能的问题:
function curl_function($uri)
{
$ch = curl_init($uri);
$timeout = 30; //set to zero for no timeout
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_USERAGENT, 'mycoreg');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
$file_contents = curl_exec($ch);
$errornum = curl_errno($ch);
$info = curl_getinfo($ch);
$status = (int) $info['http_code'];
if ($errornum !== 0) {
echo 'Error: ', curl_error($ch);
$file_contents = NULL;
}
curl_close($ch);
return $file_contents;
}
它给出的错误是
"http protocol is not supported or disabled".
请需要帮助。 谢谢。
【问题讨论】:
-
很奇怪的错误,你确定不支持
https而不是http??? -
哎呀,我刚刚发现了问题,这是我的网址中http之前的一个空格。