On Mon, 28 Aug 2000, Jeff Beard wrote:

> I just wrote a function yesterday that uses IO::Socket to interact with an 
> outside CGI program. It appears to work the way I want but this is my first 
> foray into writing TCP client code.
> 
> It's basically this:
> 
> sub tcp_client {
>      my ( $rhost, $rport, $query_string ) = @_;
> 
>      my $socket = IO::Socket::INET->new( PerrAddr => $rhost,
>                                  PeerPort => $rport,
>                                                  Proto    => "tcp",
>                                                  Type     => SOCK_STREAM)
>          or die "Couldn't connect to $rhost:$rport : $!\n";
> 
>      print $socket "GET /programname?$query_string\n";

At the very least send a HTTP/1.x part and a Host: header. Otherwise
virtual hosts are hosed.

-- 
<Matt/>

Fastnet Software Ltd. High Performance Web Specialists
Providing mod_perl, XML, Sybase and Oracle solutions
Email for training and consultancy availability.
http://sergeant.org | AxKit: http://axkit.org

Reply via email to