Bug #53842 [NEW]: the post data didn't show when using curl_getinfo($ch, CURLINFO_HEADER_OUT);
| From: | elementgi at qq dot com | Date: | Wed, 26 Jan 2011 03:55:04 +0000 |
| Subject: | Bug #53842 [NEW]: the post data didn't show when using curl_getinfo($ch, CURLINFO_HEADER_OUT); | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-158185@lists.php.net to get a copy of this message | ||
From:
Operating system: WinXP
PHP version: 5.2.17
Package: cURL related
Bug Type: Bug
Bug description:the post data didn't show when using curl_getinfo($ch, CURLINFO_HEADER_OUT);
Description:
------------
when i checking out the cURL header using CURLINFO_HEADER_OUT, the post
data didn't show in the body.
the script:
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL,
'http://www.google.com.hk/webhp?hl=zh-CN&sourceid=cnhp'
);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLINFO_HEADER_OUT, true );
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS,
http_build_query(array('a'=>'1','b'=>'2')));
$response = curl_exec( $ch );
var_dump( curl_getinfo( $ch, CURLINFO_HEADER_OUT ) );
curl_close( $ch );
unset( $ch );
Test script:
---------------
$ch = curl_init();
curl_setopt( $ch, CURLOPT_URL,
'http://www.google.com.hk/webhp?hl=zh-CN&sourceid=cnhp'
);
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLINFO_HEADER_OUT, true );
curl_setopt( $ch, CURLOPT_POST, true );
curl_setopt( $ch, CURLOPT_POSTFIELDS,
http_build_query(array('a'=>'1','b'=>'2')));
$response = curl_exec( $ch );
var_dump( curl_getinfo( $ch, CURLINFO_HEADER_OUT ) );
curl_close( $ch );
unset( $ch );
the result:
POST /webhp?hl=zh-CN&sourceid=cnhp HTTP/1.1
Host: www.google.com.hk
Accept: */*
Content-Length: 7
Content-Type: application/x-www-form-urlencoded
the expected result:
POST /webhp?hl=zh-CN&sourceid=cnhp HTTP/1.1
Host: www.google.com.hk
Accept: */*
Content-Length: 7
Content-Type: application/x-www-form-urlencoded
a=1&b=2 // <- missing this
Expected result:
----------------
POST /webhp?hl=zh-CN&sourceid=cnhp HTTP/1.1
Host: www.google.com.hk
Accept: */*
Content-Length: 7
Content-Type: application/x-www-form-urlencoded
a=1&b=2
Actual result:
--------------
POST /webhp?hl=zh-CN&sourceid=cnhp HTTP/1.1
Host: www.google.com.hk
Accept: */*
Content-Length: 7
Content-Type: application/x-www-form-urlencoded
--
Edit bug report at http://bugs.php.net/bug.php?id=53842&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53842&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53842&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53842&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=53842&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53842&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=53842&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=53842&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=53842&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=53842&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=53842&r=support
Expected behavior: http://bugs.php.net/fix.php?id=53842&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=53842&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=53842&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=53842&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53842&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53842&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=53842&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=53842&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=53842&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=53842&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=53842&r=mysqlcfg