Error while using LWP

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

Hi All

I am trying to get data from using LWP

My code is:

my $url

 use LWP::Simple;
  my $content = get $url;
  die "Couldn't get $url" unless defined $content;
  print "$content";

But its not reading the url and I am not able to get the output. Does
anyone know what mistake I m committing?


Re: Error while using LWP

# Please read docs/pods for LWP::UserAgent, HTTP::Request and
# I don't know whats wrong with your code, but the following works:

use LWP::UserAgent;

my $ua = new LWP::UserAgent();

my $url
=' *&name=Tc00.1047053420989.10&desc=yes&submit=Search';

my $response = $ua->get($url);

my $content = $response->content;
my $status_line = $response->status_line;

  print $content;
else {
  print $status_line;

Quoted text here. Click to load it

Site Timeline