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
https://forums.phpfreaks.com/topic/131887-curl-range-option-failure/
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.