[PHP] Remote File download is very slow
Hello folks, I have written a method to download file from remote server. normally those fill will be huge in size. from 1MB to 400MB. I am using fsockopen and curl to download the file. But the problem is its too slow. Very very slow. The code can be found on http://nopaste.info/55817730b3.html I just put the method body. Can any one help me on increasing the speed? Thanks in Advance -- http://talk.cmyweb.net/ http://twitter.com/shiplu
Re: [PHP] Remote File download is very slow
2008/8/25 Shiplu [EMAIL PROTECTED]: Hello folks, I have written a method to download file from remote server. normally those fill will be huge in size. from 1MB to 400MB. I am using fsockopen and curl to download the file. But the problem is its too slow. Very very slow. What happens when you remove the first half of the if(), the bit that relies on fsockopen(), and only use curl? -- http://www.otton.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remote File download is very slow
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. :( -- Blog: http://talk.cmyweb.net/ Follow me: http://twitter.com/shiplu
Re: [PHP] Remote File download is very slow
2008/8/25 Shiplu [EMAIL PROTECTED]: 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 real0m6.105s and real0m5.927s If your results are about equal, then the problem is not with PHP. -- http://www.otton.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remote File download is very slow
They take same time. let me tell you how my code works. it download a file and in the same time it reports a progress by a call back function. this script is called from web. not console. it provides live debug messages. I'll give you a time wise debug log. -- Blog: http://talk.cmyweb.net/ Follow me: http://twitter.com/shiplu
Re: [PHP] Remote File download is very slow
here are the log messages. see the timinings. [2008-08-25 18:09:05.21780900]started downloading in Live_In_Cuba_-_Louder_Than_War.part1.rar [2008-08-25 18:09:05.60409200]Headers Sent POST /files/108041147/1693469/Live_In_Cuba_-_Louder_Than_War.part1.rar HTTP/1.1 Host: rs246tl3.rapidshare.com Content-type: application/x-www-form-urlencoded User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 Firefox/2.0.0.16 Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5 Accept-language: en-us,en;q=0.7,bn;q=0.3 Accept-charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7 Connection: close Content-length: 9 [2008-08-25 18:09:06.06572600]Headers recievedHTTP/1.1 200 OK Date: Tue, 26 Aug 2008 00:09:05 GMT Connection: close Content-Type: application/octet-stream Accept-Ranges: bytes Content-Disposition: Attachment; filename=Live_In_Cuba_-_Louder_Than_War.part1.rar Content-Length: 104857600 [2008-08-25 18:09:06.06588900]Downloading started. . . [2008-08-25 18:09:11.35468500]Downloaded 262144 bytes [2008-08-25 18:09:15.26531200]Downloaded 524288 bytes [2008-08-25 18:09:20.83112600]Downloaded 786432 bytes [2008-08-25 18:09:26.26205800]Downloaded 1048576 bytes [2008-08-25 18:09:31.78788500]Downloaded 1310720 bytes [2008-08-25 18:09:37.27102800]Downloaded 1572864 bytes [2008-08-25 18:09:42.72577600]Downloaded 1835008 bytes [2008-08-25 18:09:48.08036500]Downloaded 2097152 bytes [2008-08-25 18:09:53.46441000]Downloaded 2359296 bytes [2008-08-25 18:09:58.91484500]Downloaded 2621440 bytes [2008-08-25 18:10:04.42331800]Downloaded 2883584 bytes [2008-08-25 18:10:10.00015700]Downloaded 3145728 bytes [2008-08-25 18:10:15.30924700]Downloaded 3407872 bytes see the speed?? Its too slow. -- Blog: http://talk.cmyweb.net/ Follow me: http://twitter.com/shiplu