Error while using LWP

Error while using LWP

am 01.12.2005 17:06:06 von Anshu

Hi All

I am trying to get data from www.genedb.org using LWP

My code is:

my $url
='http://www.genedb.org/genedb/Dispatcher?formType=navBar&or ganism=All%3
A*&name=Tc00.1047053420989.10&desc=yes&submit=Search';

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?

Thanks
Anshu

Re: Error while using LWP

am 05.12.2005 02:44:16 von Jimi-Carlo Bukowski-Wills

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


use LWP::UserAgent;

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

my $url
='http://www.genedb.org/genedb/Dispatcher?formType=navBar&or ganism=All%3A*&name=Tc00.1047053420989.10&desc=yes&submit=Se arch';

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

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

if($response->is_success){
print $content;
}
else {
print $status_line;
}


"Anshu" wrote in message
news:1133453166.859823.184540@g49g2000cwa.googlegroups.com.. .
> Hi All
>
> I am trying to get data from www.genedb.org using LWP
>
> My code is:
>
> my $url
> ='http://www.genedb.org/genedb/Dispatcher?formType=navBar&or ganism=All%3
> A*&name=Tc00.1047053420989.10&desc=yes&submit=Search';
>
> 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?
>
> Thanks
> Anshu
>