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

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

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

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. dpackwood
    Replies:
    3
    Views:
    2,168
  2. Siva
    Replies:
    1
    Views:
    1,441
    Jeff Dillon
    Apr 24, 2006
  3. Enigma Boy
    Replies:
    2
    Views:
    396
    Jesse Houwing
    Aug 14, 2007
  4. Bobby Edward

    How add data to Entity Data Model via code?

    Bobby Edward, Sep 23, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    491
    Bobby Edward
    Sep 23, 2008
  5. PerlFAQ Server

    FAQ 1.4 What are Perl 4, Perl 5, or Perl 6?

    PerlFAQ Server, Jan 23, 2011, in forum: Perl Misc
    Replies:
    0
    Views:
    517
    PerlFAQ Server
    Jan 23, 2011
  6. PerlFAQ Server
    Replies:
    0
    Views:
    998
    PerlFAQ Server
    Feb 3, 2011
  7. PerlFAQ Server

    FAQ 1.4 What are Perl 4, Perl 5, or Perl 6?

    PerlFAQ Server, Feb 27, 2011, in forum: Perl Misc
    Replies:
    0
    Views:
    517
    PerlFAQ Server
    Feb 27, 2011
  8. PerlFAQ Server
    Replies:
    0
    Views:
    968
    PerlFAQ Server
    Apr 4, 2011
Loading...