Tuesday, 22 January 2013

Accessing Zend Services behind a proxy !!

Now i am going to share with you guys something that peeved me quite a bit !! I had been writting a small snippet of code which was utilizing Zend_Service_Amazon . I wrote all the code back at home , expecting it to work fine when i went back to my college , so i could finish writing the remaining portion over there . But as soon as i fired up my php script in the browser i started getting an error stating that there was no response received . At first i was confused , then after enabling the error stack trace option in zend , i found out that there was a problem with the client.php file inside zend_install_folder/library/Zend/Http/ .

To use web services behind proxy we need to find the following in the client.php file :-

"protected $config= ..." ,

In the array which is assigned to the config variable , add the following lines :-

'proxy_host'=>'YOUR_PROXY_HOST',
'proxy_port'=>'YOUR_PROXY_PORT'

and find  'adapter'=>'Zend_Http_Client_Adapter_Socket' ,
Change it to 'adapter'=>'Zend_Http_Client_Adapter_Proxy'

And you'r done !!

No comments:

Post a Comment

Post a Comment