data retrievel via perl

B

batista

Hello,

I hope that someone out there can give me a good idea for this problem.
I want to write a perl-script wich send repeatedly a ID to a www-page
(http://bioinf.charite.de/superligands/compound_search.html) to
retrieve some data. I tried the LWP-module from cpan, but this doesn't
work. The challenge is that the request is processed by an php-program,
that generates the response as html. Here my code:

my $ua = LWP::UserAgent->new;
...
my $response =
$ua->request('http://bioinf.charite.de/superligands/compound_search',
hetero => '5HT');

Is it better to call directly the php-program, and in what way can I do
this?

Thanks,
Jose
 
S

Sherm Pendley

I hope that someone out there can give me a good idea for this problem.
I want to write a perl-script wich send repeatedly a ID to a www-page
(http://bioinf.charite.de/superligands/compound_search.html) to
retrieve some data. I tried the LWP-module from cpan, but this doesn't
work. The challenge is that the request is processed by an php-program,
that generates the response as html.

I haven't looked at the target URL, but for filling out and submitting
dynamically-generated forms, you might have better luck with WWW::Mechanize.

sherm--
 
B

batista

use strict;
use warnings;
use HTTP::Request::Common;
use HTML::Form;
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $request = > $ua->request( GET 'http://bioinf.charite.de/superligands/compound_search' );
my $form = HTML::Form->parse( $request->content, $request->base() );
#print $form->dump;
$form->value( 'hetero', '5HT' );
my $response = $ua->request( $form->click('B3') );
print $response->as_string;
Hope this helps

Yes, this works really fine. Thanks for the quick answer, this help me
a lot.

Jose
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top