data retrievel via perl

Discussion in 'Perl Misc' started by batista@bit.uni-bonn.de, Dec 7, 2005.

  1. -bonn.de

    -bonn.de Guest

    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
     
    -bonn.de, Dec 7, 2005
    #1
    1. Advertising

  2. "-bonn.de" <-bonn.de> writes:

    > 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--

    --
    Cocoa programming in Perl: http://camelbones.sourceforge.net
    Hire me! My resume: http://www.dot-app.org
     
    Sherm Pendley, Dec 7, 2005
    #2
    1. Advertising

  3. -bonn.de

    -bonn.de Guest

    >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
     
    -bonn.de, Dec 8, 2005
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gerry Hickman
    Replies:
    2
    Views:
    1,544
    Gerry Hickman
    Dec 14, 2005
  2. Siva
    Replies:
    1
    Views:
    1,327
    Jeff Dillon
    Apr 24, 2006
  3. Replies:
    3
    Views:
    774
    Chris Dollin
    Aug 31, 2005
  4. Enigma Boy
    Replies:
    2
    Views:
    341
    Jesse Houwing
    Aug 14, 2007
  5. Bobby Edward

    How add data to Entity Data Model via code?

    Bobby Edward, Sep 23, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    406
    Bobby Edward
    Sep 23, 2008
Loading...

Share This Page