3

I've written a simple spider to test various things with Fiddler. The script makes a few requests with Zend_Http_Client->request() using the same instance of the Zend_Http_Client class ($client in the example below).

When using Fiddler and Zend_Http_Client, only the first Zend_Http_Client->request() works; subsequent requests fail with "Unable to read response, or response is empty". Here's my Zend_Http_Client configuration with Fiddler:

$config = array(
    'adapter'       => 'Zend_Http_Client_Adapter_Proxy',
    'proxy_host'    => '127.0.0.1',
    'proxy_port'    => 8888,
    'timeout'       => 60,
    'useragent'     => 'Local Site Spider Test',
    'keepalive'     => true,
    'sslusecontext' => true
);

$client = new Zend_Http_Client('http://www.site.com/',  $config);

Here's a simplified example of what would fail, using $client from above:

$response = $client->request();
echo $response->getHeadersAsString();

$client->setUri('http://www.site.com/file.html');
$response = $client->request();
echo $response->getHeadersAsString();

The spider itself works 100% as intended when not using a proxy, so the code itself is fine. Fiddler is also working, capturing all requests from all processes (tested with WinInet as well as various browsers).

Eric C
  • 971
  • 6
  • 14
  • 2
    Maybe something is wrong with the website you're trying to access? Your code works fine for me - tested on 2 different machines (ZF 1.11.3, Fiddler 2.3.2.4 beta). 1st request: `$client = new Zend_Http_Client('http://stackoverflow.com/', $config);` and 2nd: `$client->setUri('http://stackoverflow.com/questions/5070863/zend-http-client-requests-failing-with-fiddler-proxy');` – yarson Feb 22 '11 at 18:23
  • 1
    Does it work if you set keepalive => false ? – shevron May 05 '11 at 20:45
  • @shevron no it does not work – Abadis Jul 30 '13 at 14:18

0 Answers0