http://qs321.pair.com?node_id=176177

dwatson06 has asked for the wisdom of the Perl Monks concerning the following question:

I need to connect to a cgi script in a subdirectory.
http://theSite.com/subdirectory/new_login.cgi
At what point of the socket connection do you pass the directory location ('subdirectory/newlogin.cgi')?

Originally posted as a Categorized Question.

  • Comment on How can my tcp client call a sub directory when calling a socket connection?

Replies are listed 'Best First'.
Re: How can my tcp client call a sub directory when calling a socket connection?
by scottknight (Novice) on Nov 27, 2004 at 20:23 UTC
    This seems to work for me (though I am having bad luck with a D-Link modem at the moment):
    my $sock = IO::Socket::INET->new( PeerAddr => $host, PeerPort => $port, Proto => 'tcp', Timeout => 5 ); unless ($sock) { $errormessage = $tr{'could not connect to http://$host:$port/$filen +ame'}; return '0'; } $sock->print("GET /".$filename." HTTP/1.0\r\n");
Re: How can my tcp client call a sub directory when calling a socket connection?
by merlyn (Sage) on Jun 20, 2002 at 22:37 UTC
    At no point, if you can help it. If you want to speak HTTP, use LWP::Simple.