cURL / Mailing Lists / curl-and-php / Single Mail


curl partial HTTP request

From: Shailesh N. Humbad <>
Date: Mon, 24 Mar 2008 13:03:51 -0500

Is it possible to make a partial HTTP request using Curl? This is when
making an HTTP GET request a server that does not support the HTTP range
option and does not return the file size in the HTTP headers, so the
range and max-filesize options won't work.

With fopen/fread, I can read a fixed number of bytes from the request
and then close the file handle. I want to accomplish the same thing
with curl, but can't find an option to do that. The option would allow
me to read only up to X bytes from the response, and then forcibly close
the connection.

I want to do this because the information I need is in the first 500
bytes of the file, but the whole file may be many megabytes. I'd like
to use curl instead of fopen, because the latter does not have as good
error handling.

Received on 2008-03-24