php HTTP tunnel to IMAP/POP3 using SSL

青春壹個敷衍的年華 提交于 2019-12-12 19:48:19

问题


My code should check email boxes via proxy with PHP using SSL.

Zend\Mail package provides implementation of both protocols without php extention and fits fine.

I partially override connect() method by code:

$this->socket = fsockopen($proxy, $proxy_port, $errno, $errstr, self::TIMEOUT_CONNECTION);
$this->sendRequest("CONNECT {$host}:{$port} HTTP/1.1");
$this->sendRequest("Host: {$host}:{$port}");
$this->sendRequest($userAgent);
$this->sendRequest("Proxy-Authorization: basic " . base64_encode("$user:$pass") . "\r\n");

// Remove 2 lines with proxy response
fgets($this->socket);
fgets($this->socket);

With unsecure connection everything works fine, but not works for secured port. Connections on 110 port rejected by server with "please use SSL/TLS", when script tries to connect on secure port 995, nothing happend, no any response from mail server.

Probably, I missed one more HTTP header or so.

Anybody knows which command need send to end server through HTTP tunnel to start SSL connection?

来源:https://stackoverflow.com/questions/35018585/php-http-tunnel-to-imap-pop3-using-ssl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!