Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

http get request help

by heywait86 (Initiate)
on Apr 29, 2010 at 02:27 UTC ( #837430=perlquestion: print w/replies, xml ) Need Help??
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 = ""; $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 "";

    -- 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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://837430]
Approved by ikegami
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2018-06-17 22:49 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (107 votes). Check out past polls.