Jump to content

curl range option failure


rubing

Recommended Posts

I am downloading large files via php with libcurl.  The range option does not seem to be working:

 

					
				$cp=curl_init($file);
				$fp=fopen ($g, "w");
				curl_setopt ($cp, CURLOPT_FILE, $fp);
				curl_setopt ($cp, CURLOPT_HEADER ,0);
				curl_setopt($cp,CURLOPT_CONNECTTIMEOUT,20);
				curl_setopt($cp,CURLOPT_RANGE,0-3000000);
				curl_setopt($cp, CURLOPT_USERAGENT, $useragent);
				curl_setopt($cp, CURLOPT_FOLLOWLOCATION, 1);
				curl_setopt($cp, CURLOPT_HTTPHEADER, $headers);
				curl_setopt($cp, CURLOPT_AUTOREFERER, true);
				curl_setopt($cp, CURLOPT_COOKIEJAR, "cookie.txt");
				curl_setopt($cp, CURLOPT_COOKIEFILE, "cookie.txt");
				curl_setopt($cp,CURLOPT_TIMEOUT,260);
				//lets download the mp3 directly for now
				if ($proxy!==FALSE)
					{ 
						curl_setopt($cp, CURLOPT_PROXY, $proxy);
					}

				curl_exec($cp);

 

Running this script and I receive an error like this:

 

Operation timed out after 260000 milliseconds with 4303905 out of 7709889 bytes received

 

So, obiously its downloading more than the range I specified above.

Link to comment
Share on other sites

  • 2 weeks later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.