How do I view the actual raw GET request?
$config = array(
'adapter' => 'Zend\Http\Client\Adapter\Curl',
'curloptions' => array(CURLOPT_FOLLOWLOCATION => true),
);
$client = new Client($this->uri, $config);
$client->setParameterGet(array(
'foo' => 'bar'
));
$response = $client->send($client->getRequest());
echo htmlentities($response->getBody()."<br/>"); // The response is as expected. But I need to see the RAW request so I can debug.
die();
Add:
'curloptions' => array(
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_VERBOSE => 1,
CURLOPT_STDERR => fopen('/tmp/curl.txt', 'a+'),
),
CURLOPT_VERBOSE
enables verbose output to CURLOPT_STDERR
, which we specify above as a file.
Typically, you can also use fopen('php://output', 'w')
to see debug output on the same stream echo
or print
use.
See curl_setopt()
and CURLOPT_VERBOSE for more info.