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 = 'http://genome.ucsc.edu/cgi-bin/hgBlat?hgsid=502819467_w6Oj12MTSqOIIJuSjAKsza4x9yeA&command=start';
my $browser = LWP::UserAgent->new;
my $response = $browser->post(
'$url',
[
'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 LWPtest.pl 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".
The code
'$url'
produces the 4-character string
$url
instead of
http://genome.ucsc.edu/cgi-bin/hgBlat?hgsid=502819467_w6Oj12MTSqOIIJuSjAKsza4x9yeA&command=start
Simply replace
'$url'
with
$url