Re: Connectiong Secure Server over HTTPS
| From: | Chris Adams | Date: | Wed, 26 Jul 2000 23:57:51 +0000 |
| Subject: | Re: Connectiong Secure Server over HTTPS | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-8443@lists.php.net to get a copy of this message | ||
""Sergey V. Mayzus"" <sergey@fivestars.net> wrote in message
news:8lns2c$937$1@toye.php.net...
> Hello,
>
> Please help anybody who can...
>
> How can I send data over HTTPS protocol and receive response from server
> with PHP???
>
> Example:
>
> I need to connect secure server (https://secure.server.com), POST some
data
> (var1=abc, var2=abc, ...) and receive response from server.
There are rumours that someone is building an extension to do this.
Otherwise, you can use a program like stunnel if you have it available.
Here's a snippet from a post I made to PHP-DEV about this awhile ago:
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);