Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/238.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/windows/17.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 Windows LocalHost上的下载速度慢_Php_Windows_Performance_Localhost - Fatal编程技术网

Php Windows LocalHost上的下载速度慢

Php Windows LocalHost上的下载速度慢,php,windows,performance,localhost,Php,Windows,Performance,Localhost,我在VDS上安装了localhost xammp、wampserver。当我尝试使用PHP Curl和file_get_内容获取文件时,下载速度非常低。我可以在10分钟内下载一个100mb的文件。如果我尝试用浏览器下载同一个文件,持续时间仅为3秒。原因可能是什么? 感谢您的关注。在互联网上,以特定URL下载内容是常见的做法,尤其是由于亚马逊、Alexa、Digg等公司提供的web服务和API的使用率不断增加。PHP的cURL库通常带有默认的共享托管配置,允许web开发人员完成此任务 你可以试试

我在VDS上安装了localhost xammp、wampserver。当我尝试使用PHP Curl和file_get_内容获取文件时,下载速度非常低。我可以在10分钟内下载一个100mb的文件。如果我尝试用浏览器下载同一个文件,持续时间仅为3秒。原因可能是什么?
感谢您的关注。

在互联网上,以特定URL下载内容是常见的做法,尤其是由于亚马逊、Alexa、Digg等公司提供的web服务和API的使用率不断增加。PHP的cURL库通常带有默认的共享托管配置,允许web开发人员完成此任务

你可以试试 用法 $returned\u content=获取\u数据//像这样的


或者,您可以远程使用文件获取内容功能,但许多主机不允许这样做。

您可以看到这些都是我尝试过的,下载速度很低,还有其他解决方案吗?或者,速度慢的原因是什么?感谢检查/etc/resolv.conf中是否有正确的名称服务器条目有时名称服务器速度慢会影响数据传输速度
/* gets the data from a URL */
function get_data($url) {
$ch = curl_init();
$timeout = 5;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$data = curl_exec($ch);
curl_close($ch);
return $data;
}