Aditya J. Aditya J. - 1 year ago 190
Perl Question

Perl LWP: Submitting a Query - Error 400 URL must be absolute

I need to create a script that accesses a website, submits a query, 'clicks' on one of the hits, and sends back the url of the result. What I'm stuck on is submitting the query in the first place. Here is what I have:

use strict;
use warnings;
use LWP::UserAgent;
my $entry = $ARGV[0] or die;
my $url = '';
my $browser = LWP::UserAgent->new;
my $response = $browser->post(
'sequence' => $entry,
'search' => 'submit'
die "Error: ", $response->status_line
unless $response->is_success;

I keep getting this error: Error: 400 URL must be absolute at line 14. Can someone explain what this means, and how I should fix the problem? Also how do I approach the "'clicks' on one of the hits, and sends back the url of the result" bit?


I found this on the website in question:

When including a Genome Browser URL, please remove the hgsid parameter. It is an internally-used parameter that expires after about a day.

Not sure if this is part of the problem; it may become a problem after "about a day".

Answer Source

The code


produces the 4-character string


instead of

Simply replace



Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download