Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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;

Comment on http get request help
Download Code
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2015-11-28 16:47 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (743 votes), past polls