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.s开发者_运维知识库ite.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).
精彩评论