Re: Remote File download is very slow
| From: | David Otton | Date: | Mon, 25 Aug 2008 23:08:00 +0000 |
| Subject: | Re: Remote File download is very slow | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-278705@lists.php.net to get a copy of this message | ||
2008/8/25 Shiplu <shiplu.net@gmail.com>:
> Nothing works.
> I was using curl actually.
> It was hell slow.
> Then I added the fsockeopen option.
> Its slwo too.
> now I am thinking to add socket_* functions.
> But If dont know what is the problem how can I resolve it.
> change scheme may not solve it. :(
Ok, lets start by getting some accurate data.
Here's a script that downloads a 6Mb MP3:
<?php
$fp = fopen( "temp1.mp3", "wb" );
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL, "http://gramotunes.com/Life_is_Long.mp3"
);
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, 1 );
curl_setopt( $ch, CURLOPT_FILE, $fp );
curl_exec( $ch );
curl_close( $ch );
Save it as "download.php", and run the following two commands:
time php download.php
time wget http://gramotunes.com/Life_is_Long.mp3
I get
real 0m6.105s
and
real 0m5.927s
If your results are about equal, then the problem is not with PHP.
--
http://www.otton.org/