#39611 [Opn]: Use of CURLOPT_NOBODY yields a 404 inexplicably
| From: | asbo at iserv dot net | Date: | Fri, 24 Nov 2006 07:31:05 +0000 |
| Subject: | #39611 [Opn]: Use of CURLOPT_NOBODY yields a 404 inexplicably | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-105391@lists.php.net to get a copy of this message | ||
ID: 39611
User updated by: asbo at iserv dot net
Reported By: asbo at iserv dot net
Status: Open
Bug Type: cURL related
Operating System: Windows XP Professional
PHP Version: 5.2.0
New Comment:
I thought I'd clarify a bit more; the following line:
curl_setopt($ch, CURLOPT_HEADER, true);
is extraneous. If I remove this line and and the HTTP response code
using curl_getinfo(), I'm still getting a 404.
Using NOBODY(true) in addition to RETURNTRANSFER(false) may seem
redundant, but RETURNTRANSFER(false) [as well as nothing except the URL
set] alone still has cURL dumping the remote page into the output
buffer.
Previous Comments:
------------------------------------------------------------------------
[2006-11-24 05:15:28] asbo at iserv dot net
Description:
------------
I'm running a default PHP 5.2.0 installation on Apache 2.0.55, XP Pro.
Using cURL, the introduction of the CURLOPT_NOBODY setting results in
cURL receiving a 404 page instead of the actual web page.
In my understanding, the NOBODY setting shouldn't change the actual
HTTP request at all, and therefore I should the same headers regardless
of NOBODY being set or not.
It doesn't seem like I'm missing something important -- feel free to
correct me.
Reproduce code:
---------------
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,
'http://video.google.com/videoplay?docid=1384277706451157121');
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
echo curl_exec($ch);
curl_close($ch);
?>
Expected result:
----------------
HTTP/1.1 200 OK
Set-Cookie: sloc=en
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Cache-control: private
Date: Fri, 24 Nov 2006 04:41:12 GMT
Server: GFE/1.3
<!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd"><html>
(... etc)
Actual result:
--------------
HTTP/1.1 404 Not Found
Set-Cookie: sloc=en
Content-Type: text/html; charset=UTF-8
Content-Length: 141
Cache-control: private
Date: Fri, 24 Nov 2006 04:49:49 GMT
Server: GFE/1.3
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39611&edit=1