Zend Gdata problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nuwanbando
Forum Newbie
Posts: 3
Joined: Thu Sep 06, 2007 5:17 am

Zend Gdata problem

Post by nuwanbando »

Am working behind a proxy and when i tried to make a HTTP secure connection i get the following error

Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Unable to Connect to sslv2://www.google.com:443. Error #111: Connection refused' in /nfs/www/sensoria/docs/components/com_eventmanager/gdata/ZendGdata-1.0.0/library/Zend/Gdata/ClientLogin.php:116 Stack trace: #0 /nfs/www/sensoria/docs/components/com_eventmanager/eventmanager.php(33): Zend_Gdata_ClientLogin::getHttpClient('xxxx@gma...', 'xxxx', 'cl') #1 /nfs/www/sensoria/docs/components/com_eventmanager/eventmanager.php(197): userAuth() #2 /nfs/www/sensoria/docs/index.php(183): require_once('/nfs/www/sensor...') #3 {main} thrown in /nfs/www/sensoria/docs/components/com_eventmanager/gdata/ZendGdata-1.0.0/library/Zend/Gdata/ClientLogin.php on line 116

I have added the openSSL extension to the php but still couldn't solve this problem. please help..
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Your proxy has to support HTTPS, not necessarily PHP. Does it? Also, you may want to try using https:// instead.
nuwanbando
Forum Newbie
Posts: 3
Joined: Thu Sep 06, 2007 5:17 am

Post by nuwanbando »

I dont think that is the problem [s]coz[/s] because though the browser my proxy is allowing the https connections... I think this can be fixed though the GData code..some wher to set the proxy.. any idea on that?
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.

Some examples of what not to do are ne1, any1 (anyone); u (you); ur (your or you're); 2 (to too); prolly (probably); afaik (as far as I know); etc.
ryanboyd
Forum Newbie
Posts: 2
Joined: Thu Sep 06, 2007 9:59 pm

Using a proxy with the Zend Framework / Gdata

Post by ryanboyd »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I haven't tested the code below with a real proxy server, but it should work.  The code for doing a proxied CONNECT to a SSL host is only available in SVN currently:
http://framework.zend.com/download/subversion/

This code assumes you're working with Google Calendar.  If you are, you may wish to join the community at:
http://groups.google.com/group/google-c ... lp-dataapi

You may also wish to subscribe to the zend-gdata mailing list.  More info at:
http://framework.zend.com/wiki/display/ ... +Framework

Cheers,
-Ryan

Code: Select all

<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Http_Client');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');

$client = new Zend_Http_Client('https://www.example.com/', array(
       'adapter'      => 'Zend_Http_Client_Adapter_Proxy',
       'proxy_host'   => 'myproxy.example.com',
       'proxy_port'   => 8080,
       'proxy_user'   => 'shahar',
       'proxy_pass'   => 'secret'
));

$authenticatedClient = Zend_Gdata_ClientLogin::getHttpClient('google username', 'google password', Zend_Gdata_Calendar::AUTH_SERVICE_NAME, $client, 'Company-Product-1.0');

$myService = new Zend_Gdata_Calendar($authenticatedClient);
?>

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
nuwanbando
Forum Newbie
Posts: 3
Joined: Thu Sep 06, 2007 5:17 am

Post by nuwanbando »

Thank you for the help..but it seems am getting unable to connect error message...

Fatal error: Uncaught exception 'Zend_Gdata_App_HttpException' with message 'Unable to Connect to http://www.google.com:80. Error #111: Connection refused' in /nfs/www/sensoria/docs/components/com_eventmanager/gdata/ZendGdata-1.0.0/library/Zend/Gdata/App.php:409 Stack trace: #0 /nfs/www/sensoria/docs/components/com_eventmanager/gdata/ZendGdata-1.0.0/library/Zend/Gdata/App.php(606): Zend_Gdata_App->post('<atom:entry xml...', 'http://www.goog...') #1 /nfs/www/sensoria/docs/components/com_eventmanager/gdata/ZendGdata-1.0.0/library/Zend/Gdata/Calendar.php(152): Zend_Gdata_App->insertEntry(Object(Zend_Gdata_Calendar_EventEntry), 'http://www.goog...', 'Zend_Gdata_Cale...') #2 /nfs/www/sensoria/docs/components/com_eventmanager/eventmanager.php(34): Zend_Gdata_Calendar->insertEvent(Object(Zend_Gdata_Calendar_EventEntry)) #3 /nfs/www/sensoria/docs/components/com_eventmanager/eventmanager.php(310): createEvent(NULL, 'test', 'test123', 'fast', '2006-12-01', '2006-12-08', '03:00', '-08') #4 /nfs/www/sensoria/docs/index.php(183): require_onc in /nfs/www/sensoria/docs/components/com_eventmanager/gdata/ZendGdata-1.0.0/library/Zend/Gdata/App.php on line 409

thanks for the posted links on other forums...
ryanboyd
Forum Newbie
Posts: 2
Joined: Thu Sep 06, 2007 9:59 pm

Bug in Zend_Gdata_ClientLogin

Post by ryanboyd »

Looks like there is a bug in Zend_Gdata_ClientLogin which is preventing the proxy from being used after the authentication phase.

Please see:
http://groups.google.com/group/google-c ... 252e76851c
http://framework.zend.com/issues/browse/ZF-1920

Cheers,
-Ryan
Post Reply