开发者

Zend_Feed_Reader behind a Proxy

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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜