Hi,

> sounds like a good idea. How does 'gateway' actually listen in on the
> website session?
>
> Is it simply invoked by the website with specific arguments?

        It has a socket connection that waits for an incoming request from the web
site, and then it takes what was sent from the web site, processes it, and
sends a response.  here's some code:

Perl:

#!/usr/bin/perl

use IO::Socket;

$SIG{CHLD} = sub { wait () };

my $nc_sock = new IO::Socket::INET (
        LocalHost => '192.168.3.4',
        LocalPort => '7070',
        Proto     => 'tcp',
        Listen    => 5,
        Reuse     => 1
);

while ( $nclive_sock = $nc_sock->accept() )
{
        $pid = fork();

        if ($pid == 0) {
                while ( defined( $buf = <$nclive_sock> ) )
                {
                        print $buf;

                        if ( substr( $buf, 0, 3 ) eq '000' )
                        {
                                print $nclive_sock
"4230999999000000004111111111111111470002220001999977777777777777777777423\n
";
                        } else {
                                print $nclive_sock "Hello to you too!\n";
                        }
                }

                exit(0);
        }
}

close ( $nc_sock );

Here is the PHP Web site:

        $fp = fsockopen ("192.168.3.4", 7070, $errno, $errstr, 90);

        if ( !$fp )
        {
                echo "$errstr ($errno)<br>\n";
        } else {

                fputs ( $fp, "$auth_msg\n" );

                $response = process_response( fgets( $fp ) );

                printf( "%s - %s",
                        process_code( $response['code'] ), $response['msg'] );

                fclose( $fp );
        }

Hope that helps...

-Dan Joseph

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

Reply via email to