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

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

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

Tagged:

Comments

Sign In or Register to comment.