如何
查看实际的原始 GET 请求?
$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();
添加:
'curloptions' => array(
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_VERBOSE => 1,
CURLOPT_STDERR => fopen('/tmp/curl.txt', 'a+'),
),
CURLOPT_VERBOSE
允许详细输出到 CURLOPT_STDERR
,我们上面将其指定为文件。
通常,还可以使用 fopen('php://output', 'w')
查看echo
或print
使用的同一流上的调试输出。
有关详细信息,请参阅curl_setopt()
和CURLOPT_VERBOSE。