Below you have described a client. I'm talking about a server. That was clear in my original post.
-Paul W

Greg Donald wrote:
On Tue, 4 Sep 2007, Paul wrote:
Which part do you need help with? The SSL part or the command line or the
port or ... ?

http://www.php.net/openssl
http://www.php.net/sockets

I am familiar with the above links. What I cannot locate is anything that
indicates that a cmd line socket program in PHP can do SSL. Can you locate
such? Is it in the openssl document somewhere and I missed it?

Whether the script is command line or not has nothing to do with it's ability 
to connect to a host on a specific port.  You just connect to the port the 
secure socket is located on, usually 443.

#!/usr/bin/env php
<?php
$s = socket_create( AF_INET, SOCK_STREAM, SOL_TCP );
socket_set_nonblock( $s );
socket_connect( $s, "example.com", 443 );
socket_set_block( $s );
switch( socket_select( $r = array( $s ), $w = array( $s ), $f = array( $s ), 5 
) )
{
    case 2:
        echo "[-] Connection Refused\n";
        break;
    case 1:
        echo "[+] Connected\n";
        break;
    case 0:
        echo "[-] Timeout\n";
        break;
}



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to