Bug #53842 [Opn->Bgs]: the post data didn't show when using curl_getinfo($ch, CURLINFO_HEADER_OUT);
| From: | aharvey@php.net | Date: | Wed, 26 Jan 2011 06:08:18 +0000 |
| Subject: | Bug #53842 [Opn->Bgs]: the post data didn't show when using curl_getinfo($ch, CURLINFO_HEADER_OUT); | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-158190@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=53842&edit=1
ID: 53842
Updated by: aharvey@php.net
Reported by: elementgi at qq dot com
Summary: the post data didn't show when using
curl_getinfo($ch, CURLINFO_HEADER_OUT);
-Status: Open
+Status: Bogus
Type: Bug
Package: cURL related
Operating System: WinXP
PHP Version: 5.2.17
Block user comment: N
Private report: N
New Comment:
As the name suggests, CURLINFO_HEADER_OUT only tracks the request
headers, not the entire request body.
Previous Comments:
------------------------------------------------------------------------
[2011-01-26 04:55:03] elementgi at qq dot com
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 this bug report at http://bugs.php.net/bug.php?id=53842&edit=1