Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

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 = "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;

Comment on http get request help
Download Code
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://837430]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2014-07-24 05:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (158 votes), past polls