Zend Framework Curl - 调试 GET

Zend Framework Curl - debug GET

如何查看实际的原始 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') 查看同一流上的调试输出 echoprint 使用。

有关详细信息,请参阅 curl_setopt() and CURLOPT_VERBOSE