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


In reply to Re: Pattern Matching by lestrrat
in thread problem using Net::Telnet to GET a page by sidhartha

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.