tags:

views:

47

answers:

1

am new to Zend and want to use the Zend_Feed_Reader class behind a Proxy.

I've been told that I need "replace the default instance of Zend_Http_Client used by Zend_Feed_Reader using the setHttpClient() static method. The replacement should be a new Zend_Http_Client object which is passed a replacement adapter called Zend_Http_Client_Adapter_Proxy" but am very stuck -

Can someone offer a code example to do the above please? Many thanks.

+1  A: 

I'm guessing you've since got around this problem, but FWIW:

$adapter = new Zend_Http_Client_Adapter_Proxy();
$adapter->setConfig(array(
  'proxy_host' => 'your.proxy.addr', // IP or host name of proxy server
  'proxy_port' => 8888,              // proxy port. If not specified, 8080 will be used
  'proxy_user' => 'myuser',          // user for proxy authentication, if needed
  'proxy_pass' => 's3cr3t'           // proxy password, if needed
));

Zend_Feed_Reader::getHttpClient()->setAdapter($adapter);

Make sure to replace the options with your proxy configuration (drop proxy_user and proxy_pass if not required).

Then, any feed reader you instantiate will go through your proxy server.

More info on configuring the proxy adapter here: http://framework.zend.com/manual/en/zend.http.client.adapters.html#zend.http.client.adapters.proxy

Shahar Evron