Reputation: 3146
I want to debug a curl request and check what post arguments were passed in the request.
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLINFO_HEADER_OUT, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($ch, CURLOPT_CAINFO, MERCHANT_CONFIG_PATH.'/cacert.pem');
curl_setopt($ch, CURLOPT_VERBOSE, true);
var_export(curl_getinfo($ch));
but I only see this
[request_header] => POST /nvp HTTP/1.1
Host: api-3t.sandbox.paypal.com
Accept: */*
Content-Length: 728
Content-Type: application/x-www-form-urlencoded
Does this mean the post data wasn't included in the request?
Upvotes: 3
Views: 3129
Reputation: 7195
No. That doesn't mean your POST data wasn't included into request. CURL doesn't always output content of sent data, it depends on your server settings. However you don't need to see that content because CURL send POST data exactly as it given in CURLOPT_POSTFIELDS
option. The only exception is when you set this option to an array. But even in this case you can forecast exact content of sent data by reproducing manipulations CURL perform with given array (http_build_data
and urlencode
) and comparing length of the result with value of Content-Length
request header.
Upvotes: 3