in reply to problem using Net::Telnet to GET a page
I second dws's opinion -- you should probably be using LWP::UserAgent or LWP::Simple.
That being said, your theory as to why your code doesn't work is probably not right. The output that you speak of is emitted by the command telnet. If you were to directly connect to the HTTP port via some socket, then you wouldn't see those messages, because after all that's not part of the protocol.
The real reason you're not getting any response back is because $telnet->cmd() is failing, and it's failing because it can't find the 'prompt'. the cmd() method prints some command over the socket, and it waits to see the prompt ( that's how it knows that the command has finished executing ). So think about it: if you login to a UNIX host via telnet, you get some sort of shell prompt. And that's fine, but you wouldn't get that in an HTTP connection, because it's not meant to be interactive like the shell. And so when you send the command via Net::Telnet, it waits and waits for the prompt, but never gets it.
Anyway, this just means that Net::Telnet is not for this particular application. It's great to emulate somebody logging in to a host and executing a few commands, but not for this
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Pattern Matching
by sidhartha (Acolyte) on Feb 08, 2002 at 03:27 UTC |