PHP Mutli Range Resume Supported segmented downloading
New on LowEndTalk? Please read our 'Community Rules' by clicking on it in the right menu!

PHP Mutli Range Resume Supported segmented downloading

noamannoaman Member
edited October 2015 in Help

I am using free download manager to test multi thread downloading with resume support.The programming language used as you can see is PHP.
<br /> if(isset($_SERVER['HTTP_RANGE']))<br /> {<br /> // Resume requested<br /> preg_match('/bytes=(\d+)-(\d+)?/', $_SERVER['HTTP_RANGE'], $matches);<br /> $range=explode('-', $_SERVER['HTTP_RANGE'], 2);<br /> $items=count($range);<br /> if($items != 2){<br /> header('HTTP/1.1 416 Requested Range Not Satisfiable');<br /> die(); } <br /> $offset = $range[0];<br /> $length = $range[1] - $offset;<br /> $content_length=$length-1;<br /> header("HTTP/1.1 206 Partial Content");<br /> header('Content-Range: bytes ' . $offset . '-' . ($offset + $length) . '/' . $filesize);<br /> $current_position=$offset;<br /> $next_postion=(int)$range[1];<br /> header("Content-Length: ".$content_length);<br /> $chunk="SOme_aribitray_data";<br /> echo $chunk;<br /> die();<br /> }<br />

The problem is that it is not allowing me to create segments or parts.What cany be the reason?
I think the error is in this portion of the code ....

Also How do you debug this kind of PHP code ?
I have installed ModHeader Chrome Plugin.But can anybody recommend some dev tools for http protocol and headers

Thanx in advance


Sign In or Register to comment.