[thelist] Can you open a url with a cgi script?

Diane Soini dianesoini at earthlink.net
Fri Aug 8 09:00:14 CDT 2003


Thank you so much. That looks like it might work. I'll give it a try 
today when I get to work.

A thousand thanks!

Diane

On Friday, August 8, 2003, at 04:03 AM, thelist-request at lists.evolt.org 
wrote:
>
> You'll need to tweak the following code a little but try:
>
>
> #!/usr/bin/perl -w
>
> use strict;
> use Socket;
>
> my $ip = inet_aton($ARGV[0]) || die "inet_aton: $!\n";
>
> socket(HTTP, PF_INET, SOCK_STREAM, getprotobyname('tcp')) || die 
> "socket: $!\n";
> connect(HTTP, sockaddr_in(80, $ip)) || die "connect: $!\n";
>
> my $old_fh = select(HTTP);
> $| = 1;
> select($old_fh);
>
> print HTTP "GET / HTTP/1.0\n\n";
>
> while (defined(my $line = <HTTP>)) {
>     print $line;
> }
>
> close(HTTP) || die "close: $!\n";
>
> 1;
>
>
> Dean
> ------------------------------



More information about the thelist mailing list