using imap_open behind proxy

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
nashbur
Forum Newbie
Posts: 2
Joined: Fri Mar 06, 2009 12:30 am

using imap_open behind proxy

Post by nashbur »

Hi,

I sit inside a lan whose outgoing traffic is routed through a proxy server. and it requires authentication. E.g. to open http://www.gmail.com using firefox, i have to select 'manual proxy configuration' option. i give server n port number there. n provide username n password (for proxy).

Now here is my problem.
$connection = imap_open('{imap.gmail.com:993/ssl}', 'xyz@gmail.com', 'gmail-password') or die("can't connect: " . imap_last_error());

Usually this should connect to gmail inbox. but since I am behind a proxy, the proxy also needs to be authenticated. I am stuck about how to do that.

To explain more, i will give one more example. While using 'wget' , I have to set
http_proxy = http://proxy-server:80/
proxy-user = proxy-user
proxy-passwd = proxy-pass

So, I think, for imap_open also, i will have to do similar thing. but im not sure how to do that.
can anyone help?

thanks
nashbur
Forum Newbie
Posts: 2
Joined: Fri Mar 06, 2009 12:30 am

Re: using imap_open behind proxy

Post by nashbur »

To help you more understand the problem, here is the error I am getting.

Warning: imap_open() [function.imap-open]: Couldn't open stream {imap.gmail.com:993/imap/ssl/tls}INBOX in /home/www/mysite/php/connection.php on line 7
Array ([0] => Can't open mailbox {imap.gmail.com:993/imap/ssl/tls}INBOX: invalid remote specification )

Is this really due to proxy problem?


guys, please help
Post Reply