Re: range header in curl?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Is range the right header to be sending? I thought it was something else.

Also I believe there is a curl_setopt option for range... Look at php.net's predefined constants for the curl modul

On Nov 21, 2010, at 3:05 PM, Tontonq Tontonq <rootdot@xxxxxxxxx> wrote:

> hi im downloading files from h0tf1le as a premium user by curl i want to do
> something like streaming i want it resend to user what it got from server
> i couldnt find any resource about curl and streaming the executed source
> so i did by the Range header but sometimes i see files are corrupted i check
> the logs
> 
> GET
> http://s137.hotfile.com/get/7006d266367d7975861e5f7200b604ad478674fc/4ce9a4ff/1/f37a0969e2e26077/332dfdf/2137758/pimp.rarHTTP/1.1
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.9.2)
> Gecko/20100115 Firefox/3.6
> Host: s137.hotfile.com
> Pragma: no-cache
> Accept: */*
> Connection: Keep-Alive
> Range: bytes=1-2
> 
> i only get 1 byte for learn length
> 
> 
> Content-Disposition: attachment; filename="pimp.rar"
> Content-Transfer-Encoding: binary
> Content-Range: bytes 1-2/5781810
> 
> i see the range
> 
> request:Range: bytes=0-2097152
> response:
> Content-Disposition: attachment; filename="pimp.rar"
> Content-Transfer-Encoding: binary
> Content-Range: bytes 0-2097152/5781810
> Connection: close
> 
> request:Range: bytes=2097152-4194304
> response:
> Content-Disposition: attachment; filename="pimp.rar"
> Content-Transfer-Encoding: binary
> Content-Range: bytes 2097152-4194304/5781810
> Connection: close
> 
> request:Range: bytes=4194304-5781810
> 
> Content-Disposition: attachment; filename="pimp.rar"
> Content-Transfer-Encoding: binary
> Content-Range: bytes 4194304-5781810/5781810
> Connection: close
> 
> 
> i can not see any error do you?
> 
> and this is a part of it
> 
> 
> 
> $kackb=arasi('Content-Range: bytes 1-2/','
> ',$cikti);
> $bytes=(int)$kackb;
> $infocuk=curl_getinfo($ch);
> $sabiturl=$infocuk["url"];
> curl_close($ch);
> $sinir*=1024;
> $kackez=$bytes/$sinir;
> 
> 
> for($i=0;$i<=$kackez;$i++)
> {
> $bsinir=$i*$sinir;
> $ssinir+=$sinir;
> if($bytes<$ssinir) { $ssinir=$bytes; }
> $header = array("Range: bytes=$bsinir-$ssinir");
> $ch = curl_init();
> curl_setopt($ch , CURLOPT_URL, $sabiturl);
> curl_setopt($ch , CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT
> 5.1; tr; rv:1.9.2) Gecko/20100115 Firefox/3.6');
> curl_setopt($ch , CURLOPT_COOKIEJAR, dirname(__FILE__).'/cookies.txt');
> curl_setopt($ch , CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookies.txt');
> curl_setopt($ch , CURLOPT_COOKIEFILE, dirname(__FILE__).'/cookies.txt');
> if($proxy) { curl_setopt($ch , CURLOPT_PROXY, $proxy); }
> curl_setopt ( $ch , CURLOPT_HTTPHEADER, $header );
> curl_setopt($ch , CURLOPT_FOLLOWLOCATION, 1);
> curl_setopt($ch , CURLOPT_RETURNTRANSFER , 1);
> $cikti = curl_exec($ch);
> echo $cikti;
> 
> }

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux