Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/278.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP cURL XML文件响应速度慢_Php_Xml_Curl - Fatal编程技术网

PHP cURL XML文件响应速度慢

PHP cURL XML文件响应速度慢,php,xml,curl,Php,Xml,Curl,我试图使用cURL从其他网站返回XML,但为什么这个过程如此缓慢?以下是我目前的代码: ini_set("display_errors", 1); error_reporting(E_ALL); $url = 'http://www.simbrief.com/ofp/flightplans/xml/1497850469_B5D3D239A1.xml'; function file_get_contents_curl($url) { $ch = curl_init(); curl_setopt($

我试图使用cURL从其他网站返回XML,但为什么这个过程如此缓慢?以下是我目前的代码:

ini_set("display_errors", 1);
error_reporting(E_ALL);
$url = 'http://www.simbrief.com/ofp/flightplans/xml/1497850469_B5D3D239A1.xml';
function file_get_contents_curl($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); 
curl_setopt($ch, CURLOPT_TIMEOUT, 10);     
if(curl_errno($ch)) return 'Curl error: ' . curl_error($ch);
$data = curl_exec($ch);
curl_close($ch);

return $data;
}

$data = file_get_contents_curl($url);       
echo $data;
值returnempty response(因为我将timeout选项添加到了10s,所以我假设数据没有完全传输),更奇怪的是这个脚本在我的本地服务器上工作(使用XAMPP),但在我的主机上不工作

任何形式的帮助都将被感激,
谢谢

听起来像是一个独立于curl的网络问题。分析网络流量,联系你的主机支持人员,他们应该能够告诉你,我不能,对不起。有关底层网络运营的更多信息,请参阅我之前的感谢您的回复,我认为您是对的,这是主机问题,我现在正试图联系他们,看看什么是最好的解决方案Sounds喜欢独立于curl的网络问题。分析网络流量,联系你的主机支持人员,他们应该能够告诉你,我不能,对不起。有关底层网络运营的更多信息,请参阅我之前的感谢您的回复,我认为您是对的,这是托管问题,我现在正试图联系他们,看看什么是最好的解决方案