curl-and-php
Header Request Question
Date: Wed, 18 Apr 2007 05:33:14 -0700
Hello
I am wondering what is the best method to just return the header from
a request. My problem is that over 50% of the servers I have tested
disallow HEAD type requests so using CURLOPT_NOBODY in the request
results in returning.
HTTP/1.1 405 Method Not Allowed
So why can CURL not just send a GET/POST request and only read up to
the end of the header.
// set to method GET
CURLOPT_HTTPGET, true
// use GET but only read the header and return it
CURLOPT_NOBODY, true // yuk, this switches back to a HEAD request
I ask this, because there are times when developing that you need to
test the header before attempting to get the body content, so as to
maybe test the content type or content length before sending a second
request for the body, this way if the header test(s) return what your
application allows, send a request for the body, if it doesn't you
will save time from downloading what you don't need.
Thanks for reading...
John
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
Received on 2007-04-18