
Generating an HTTP Request From a Script?
In article <3177F917.1...@kingtech.com>, Bill Koss <wk...@kingtech.com> wrote:
You just have to open a connection to the server, here's an example using
perl 5 (mainly stolen from the perlipc man page...)
#!/usr/local/bin/perl
use Socket;
$host = 'localhost';
$port = 80;
$request = 'GET /cgi-bin/glimpse';
$iaddr = inet_aton $host or die "no address for $host ($!)\n";
$paddr = sockaddr_in $port, $iaddr;
$proto = getprotobyname 'tcp' or die "can't look up 'tcp'\n";
socket S, PF_INET, SOCK_STREAM, $proto or die "socket failed ($!)\n";
connect S, $paddr or die "connect failed ($!)\n";
$oldFh = select S; # unbuffer the socket
$| = 1;
select $oldFh;
print S "$request HTTP/1.0\n\n";
while (<S>)
{
print;
__END__
Hope this helps,
Mike
--
Mike Stok | The "`Stok' disclaimers" apply.
s...@pencom.com | Pencom Systems Administration (work)
s...@{*filter*}com.net | {*filter*} Access (play)
http://www.{*filter*}com.net/~stok/ | The inevitable WWW page (?)