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

Hi, I don't know if this is even possible, but I'm trying to do a html get request with perl. I've tried using several modules, but have had no success, my current code looks like this, I'm sure I'm doing it all wrong but this is what I have based on googling.
#!/usr/bin/perl use Net::Telnet (); $server = "xxxx.xxxxxxx.xxx"; $cmd = "GET / HTTP/1.1\n\n"; $t = new Net::Telnet ("Timeout" => 10, "Port" => 81 "Prompt" => ''); $t->open($server); @lines = $t->cmd($cmd); print @lines;

Replies are listed 'Best First'.
Re: http get request help
by merlyn (Sage) on Apr 29, 2010 at 02:48 UTC
    use LWP::Simple; my $result = get "http://www.perlmonks.org";

    -- Randal L. Schwartz, Perl hacker

    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

Re: http get request help
by pemungkah (Priest) on Apr 29, 2010 at 02:51 UTC
    Yep, you're doing it all wrong. You really, really want to be using LWP or WWW::Mechanize. Either of those should Just Work for you.