----- Original Message ----- 
From: "Paul Maine Jr." <[EMAIL PROTECTED]>
To: "Active State Perl (E-mail)" <[EMAIL PROTECTED]>
Sent: Tuesday, March 27, 2001 11:37 PM
Subject: Perl Socket/WWW Challenge


> I am using Perl to create a socket connection to a web server. I issue the
> following command to a web server:
> GET / HTTP/1.0
> 
> This command works fine on several of my web servers however, when I try the
> same script on one web server - I get the following result.
> 
> Connection closed by foreign host.
> 
> I tried the same thing by telnetting into port 80 at a particular IP
> address. The connection closed error is returned by telnet. Any ideas on
> what the problem might be?


Maybe try to send "Host" or "User-Agent" header:

GET / HTTP/1.0
Host: www.some-host.org
User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)

Have you considered using LWP or LWP::Simple module?
You can do something like this with them:

#!/usr/bin/perl
use LWP::Simple;

my $Index = get(http://www.some-host.org/);

-- 
 Marek Wojcik
 [EMAIL PROTECTED]

¶+Þ=êå�¨¥�x%�Ë@rدx÷«�X¬¶Ç«¼-�÷�µ«^r�¡¶ÚþX¬¶Ç«¼-�÷�µ«^r�¿�¨¥�©ÿ�+-�wèý§-�÷©z¹

Reply via email to