Side note: drupal_http_request takes a retry for the very same purpose of auto follow, but since its defaulted to 3, you should have got the content-length unless its doing more than 3 redirections.<br>
<br><br><div class="gmail_quote">On Sun, Dec 6, 2009 at 9:21 PM, Dipen <span dir="ltr">&lt;<a href="mailto:dipench@gmail.com">dipench@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi nitin, <div><br></div><div> It would return Content-Length as the main application of using HEAD is for proxies to find if the cached copy can be used or not, availability of Content-Length is mandatory to do those kind of checks. In any case you must be getting a redirection maybe 301, 302 in status code so you would need to follow the location. </div>

<div><br></div><div>For example I just tried looking for header info on <a href="http://facebook.com/login.php" target="_blank">http://facebook.com/login.php</a> and I got a redirection 301 to <a href="http://www.facebook.com/login.php" target="_blank">www.facebook.com/login.php</a> and in that location u would receive content-length. </div>

<div><br></div><div>I used this tool : <a href="http://www.rexswain.com/httpview.html" target="_blank">http://www.rexswain.com/httpview.html</a> </div><div><br></div><div>First try with <a href="http://www.facebook.com/login.php" target="_blank">www.facebook.com/login.php</a> and it would give u content-Length in first hit ( do not forget to use HEAD as method type)</div>

<div><br></div><div>Then try with <a href="http://facebook.com/login.php" target="_blank">http://facebook.com/login.php</a> and auto follow enabled and this time u would get it in the location 2. </div><div><br></div><div>
Cheers</div><div>
Dipen<div><div></div><div class="h5"><br><br>
<br><br><div class="gmail_quote">On Sun, Dec 6, 2009 at 9:08 PM, nitin gupta <span dir="ltr">&lt;<a href="mailto:nitingupta.iitg@gmail.com" target="_blank">nitingupta.iitg@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

Thanks Dipen, It works perfectly well. Thanks for making me aware of the HEAD method. <br><br>The headers does not contain &quot;content-length&quot; when invoked on a .php page, is this in accordance with the protocol?<div>

<br>

<br clear="all">--<br>Regards,<br>Nitin Kumar Gupta<br><a href="http://publicmind.in/blog/" target="_blank">http://publicmind.in/blog/</a><br>
<br><br></div><div><div></div><div><div class="gmail_quote">On Sun, Dec 6, 2009 at 8:46 PM, Dipen <span dir="ltr">&lt;<a href="mailto:dipench@gmail.com" target="_blank">dipench@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">

I havent tried it doing it with drupal but try passing method = HEAD.<div><br></div><div>HEAD /index.html </div><div><br></div><div>would fetch only headers of that resource, where as GET for instance would also return the content.</div>




<div><br></div><div>Cheers</div><div>dipen </div><div><div></div><div><div><br></div><div><br>
<br><br><div class="gmail_quote">On Sun, Dec 6, 2009 at 7:52 PM, nitin gupta <span dir="ltr">&lt;<a href="mailto:nitingupta.iitg@gmail.com" target="_blank">nitingupta.iitg@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left:1px solid rgb(204, 204, 204);margin:0pt 0pt 0pt 0.8ex;padding-left:1ex">




Hi,<br><br>I am currently using curl (CURLOPT_NOBODY) to exclude the body and to just get the headers returned by the sever for a http request. I am specifically interested in the return status code and the content length. Can I do it using drupal_http_request? What will be the suitable value for the $headers, so that I don&#39;t need to download the whole page?<br>






<br><a href="http://api.drupal.org/api/function/drupal_http_request/6" target="_blank">http://api.drupal.org/api/function/drupal_http_request/6</a><br><font color="#888888"><br>--<br>Regards,<br>Nitin Kumar Gupta<br><a href="http://publicmind.in/blog/" target="_blank">http://publicmind.in/blog/</a><br>






</font></blockquote></div><br></div>
</div></div></blockquote></div><br>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br>