Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
Shells Virtual Desktop
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

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

Comments

  • NixtrenNixtren Member
    edited October 2015

    Fiddler2 is an HTTP Proxy used for HTTP debugging. One of the essentials tools in my opinion. Only available for Windows though (maybe you can run it under Mono if your computer is a Linux one).

  • @nixtren
    Thanx for the tool .I will look into that

Sign In or Register to comment.