|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39611 Use of CURLOPT_NOBODY yields a 404 inexplicably
Submitted: 2006-11-24 05:15 UTC Modified: 2006-11-24 09:02 UTC
From: asbo at iserv dot net Assigned:
Status: Not a bug Package: cURL related
PHP Version: 5.2.0 OS: Windows XP Professional
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: asbo at iserv dot net
New email:
PHP Version: OS:


 [2006-11-24 05:15 UTC] asbo at iserv dot net
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:
$ch = curl_init();
  curl_setopt($ch, CURLOPT_URL, '');
  curl_setopt($ch, CURLOPT_HEADER, true);
  curl_setopt($ch, CURLOPT_NOBODY, true);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
  echo curl_exec($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" ""><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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-24 07:31 UTC] asbo at iserv dot net
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.
 [2006-11-24 09:02 UTC]
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Wed Mar 03 03:01:24 2021 UTC