views:

306

answers:

1

I'm trying to access Gmail by using three-legged Oauth PHP code provided by Google ('google-mail-xoauth-tools') here: http://code.google.com/apis/gmail/oauth/code.html. I have my domain registered and everything seems to go fine with OAuth, but after I authorize access I get this error:

Fatal error: Uncaught exception 'Zend_Mail_Protocol_Exception' with message
'cannot connect to host; error = Connection refused (errno = 111 )'
     in /home/tchaymor/public_html/gmail/Zend/Mail/Protocol/Imap.php:100
Stack trace: #0 /home/tchaymor/public_html/gmail/Zend/Mail/Protocol/Imap.php(61):           
                  Zend_Mail_Protocol_Imap->connect('imap.gmail.com', '993', true)
             #1 /home/tchaymor/public_html/gmail/three-legged.php(170):
                  Zend_Mail_Protocol_Imap->__construct('imap.gmail.com', '993', true)
             #2 {main} thrown in /home/tchaymor/public_html/gmail/Zend/Mail/Protocol/Imap.php on line 100 

This is my first time using OAuth with any Google products, so it could be something totally brainless I'm missing. Any suggestions would be most welcome (as suggestions for easier alternatives). I'm more on the designer rather than coder end, so the simpler the better.

A: 

Effectively, this is failing:

fsockopen('ssl://imap.gmail.com', 993);

Several options:
1) The error would suggest google is actively blocking you, perhaps you have tested & failed a bit to much, and just have to wait untill a temporary blockade is lifted.
2) The error would be different, but just to be sure: allow_url_fopen is enabled?
3) Local firewall? (What does a telnet imap.gmail.com 993 from the server give you?)
4) Broken OpenSLL libraries are also possible, try to connect a valid https site: fsockopen("ssl://google.com",443,$errno,$errstr) or die($errstr);

Wrikken
Thanks for quick and comprehensive response. Here is my response:1) I think the error is different for a temporary blockade and, in any event, has not been lifted even when hours passed with no attempts.2) allow_url_fopen is enabled4) this connection seems to work just fine, though often get a timeout error.As far as firewall, I've contacted my hosting company and they've assured me there is no firewall issue, but having issues checking myself via ssh (HostGator).
tchaymore
Finally got ssh access and my telnet connection was refused, so probably firewall problem.
tchaymore
Erm, hope you didn't copy paste that, there just to be excess '9' in the telnet line untill a few seconds ago. If you did, recheck :)
Wrikken
No problem -- I caught it and changed it to 993. Now trying to convince hosting company it's their problem.
tchaymore
Took a couple of tries, but convinced hosting co. it was their problem and then they let down the firewall for 993. Works great now, thanks for the help.
tchaymore