Popcorn Dave has asked for the wisdom of the Perl Monks concerning the following question:
I'm starting to play around with the HTTP and LWP modules and I'm running in to some small problems.
My problems are with the HTTP::Headers and the output I'm getting from the code I've written.
With the HTTP::Headers module, exactly how many of the variables do I need to specify? For the web site I'm trying to get the info off of, it has an applet that is looking for the root page as a referral. I tested this theory in Opera and it wouldn't work without the referral being sent.
My other problem is that when I do actually get information out of the script off other sites, it's printing out the address of the hash, not the content.
My code is as follows:
#!/usr/bin/perl -w use strict; use LWP::UserAgent; use HTTP::Request::Common; use HTTP::Headers; my @list; my ($name, $url, $pic); my $refurl = 'http://www.kingfeatures.com'; my %cartoon; open FH, ">zippy.gif"; binmode FH; # necessary to convert pictures streamed to graphics my $bot = new LWP::UserAgent; my $stream = new HTTP::Request( GET => "http://www.kingfeatures.com/fe +atures/comics/mutts/aboutMaina.php" # Referer => $refurl ); $pic = $bot->request($stream); print "$pic->content($stream)\n" if $pic->is_success; print FH $pic; close FH;
I'd appreciate any light anybody could shed on this and if anyone knows of anything other than the module docs that would give me a bit more guidance.
There is no emoticon for what I'm feeling now.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: HTTP::Request questions
by blokhead (Monsignor) on Oct 26, 2002 at 07:30 UTC | |
by Popcorn Dave (Abbot) on Oct 26, 2002 at 21:14 UTC |