|
COMPARE PRICES: Digital
cameras, MP3
Players, Camcorders, Mobile phones,
PDA, Computers, Electronics LCD monitors,
Printers,
Notebook,
DVD Players,
Motherboards,
TV,
ipod,
Processors.
See all...
|
|
cURL Mailing List Monthly Index Single Mail
curl-and-php mailing list Archives
Re: Fake-referer and remote file-exist check & size-check usinglibcurl?...
Thanks Daniel!
And how do I do a http-get request with a fake referer and custom user-agent?
Care to post an example?
Regards
Fernando
Daniel Stenberg wrote:
>
> On Thu, 27 Feb 2003, Fernando Cassia wrote:
>
> > 1) Can I use libcurl to replace the "file_size" function and query the
> > remote file size?. how?
>
> (Please note that I'm not a PHP-dude, I'm talking from a general libcurl
> perspective here.)
>
> Yes, probably. If you use a HEAD request to the site with the JPEG, it'll
> return headers containing the size of the object.
>
> You make a HEAD request by using the CURLOPT_NOBODY option.
>
> > 2) How can I check if the remote file I'm querying exists (is a jpeg) or
> > instead the remote web server forwards me to the providers' 404 page?
>
> Sure. If you attempt to get it, you'll get a set of headers and a 404 code
> back if it doesn't exist. I'm not sure how much the PHP binding reflects
> this, but using the curl_easy_getinfo() you can get the HTTP code from the
> last request, or you can possibly use the CURLOPT_FAILONERROR option. Or
> simply parse the returned headers yourself.
>
> > 3) Anyone cares to post a "fake-referer" http-get, first checking if the
> > file exists and its size?
>
> Steps:
>
> 1. Set CURLOPT_REFERER to a suitable URL
> 2. do a HEAD
> 3. If the code is not 404, check the size
> 4. get the image.
>
> Not that I understand why you need to get the size first. You'll figure out
> how big the image is when you get it! ;-)
>
> --
> Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs.
>
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2003-02-27
These mail archives are generated by hypermail.
|