Re: Using SSL & Fsockopen...
| From: | Chris Adams | Date: | Sun, 25 Jun 2000 23:54:52 +0000 |
| Subject: | Re: Using SSL & Fsockopen... | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-22318@lists.php.net to get a copy of this message | ||
> Hi, I am neeeding to open a secure socket, but I couldn't find any solution
> other than to use a relying server. I would prefer to use a native php
> function... I was looking at some sites of php resources but I didn´t have
> any luck yet.
I think this would require a good deal of work to implement as you'd basically need to
incorporate
an entire SSL library into PHP.
A much easier approach would be to use popen() on stunnel. Something like stunnel -c -r
secure.server.com:443 -f will open an SSL channel to the remote server. stdin will be sent to the
remote server and responses back will be output to stdout. Your code could look something like:
$ssl_sock = popen("stunnel -c -r remote_web_server_address:443 -f");
fputs($ssl_sock, "GET / HTTP/0.9\r\n\r\n");
while (!feof($ssl_sock)) {
echo fgets($ssl_sock, 4096);
}
pclose($ssl_sock);