#27341 [Bgs->Opn]: CURLOPT_RETURNTRANSFER and CURLOPT_CUSTOMREQUEST incompatibility?
| From: | derick@php.net | Date: | Sat, 21 Feb 2004 15:15:24 +0000 |
| Subject: | #27341 [Bgs->Opn]: CURLOPT_RETURNTRANSFER and CURLOPT_CUSTOMREQUEST incompatibility? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-55287@lists.php.net to get a copy of this message | ||
ID: 27341
Updated by: derick@php.net
Reported By: matteo at beccati dot com
-Status: Bogus
+Status: Open
Bug Type: cURL related
Operating System: Win32 - Linux
PHP Version: 4.3.4
New Comment:
Interesting :)
Previous Comments:
------------------------------------------------------------------------
[2004-02-21 08:30:19] daniel at haxx dot se
I beg to differ.
CURLOPT_RETURNTRANSFER is not an option that libcurl provides, it is an
option that the PHP/CURL layer has invented and uses.
Thus, we cannot fix this in the curl project. It is not a curl bug!
------------------------------------------------------------------------
[2004-02-21 04:10:55] matteo at beccati dot com
> Ask the curl author(s).
Done.
http://sourceforge.net/tracker/index.php?func=detail&aid=901648&group_id=976&atid=100976
> Not PHP bug (if it even is a bug which I doubt).
You're probabiliy correct saying that it's not a PHP bug, but it really
seems a wrong cURL behaviour to me.
When setting CURLOPT_RETURNTRANSFER I'm asking curl_exec to return the
result instead that outputting it, but result isn't returned, neither
printed out.
Thank you for your help.
------------------------------------------------------------------------
[2004-02-21 02:57:08] sniper@php.net
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 http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
Not PHP bug (if it even is a bug which I doubt).
Ask the curl author(s).
------------------------------------------------------------------------
[2004-02-21 02:41:18] matteo at beccati dot com
Description:
------------
Trying to help a friend which wanted to do a curl HEAD request with php
(just like the shell curl -I does), I wrote down this code, without
much checking:
$ch = curl_init('http://foo/bar.html');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD');
var_dump(curl_exec($ch));
In fact he tried it and told me it doesn't work, while this does:
$ch = curl_init('http://foo/bar.html');
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD');
ob_start();
curl_exec($ch);
var_dump(ob_get_clean());
phpinfo() tels me that I'm running:
libcurl/7.10.5 OpenSSL/0.9.7b zlib/1.1.4
I've also seen bug #15279, but it was marked as documentation problem,
and didn't explain this weird issue.
Reproduce code:
---------------
$ch = curl_init('http://beccati.com/img/adv.png');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'HEAD');
var_dump(curl_exec($ch));
Expected result:
----------------
string(214) "HTTP/1.1 200 OK
Date: Sat, 21 Feb 2004 07:39:06 GMT
Server: Apache
Last-Modified: Wed, 06 Aug 2003 12:35:16 GMT
ETag: "27c64-204-3f30f604"
Accept-Ranges: bytes
Content-Length: 516
Content-Type: image/png
"
Actual result:
--------------
bool(false)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=27341&edit=1