Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Perl Mechanize

by zoya (Initiate)
on Apr 22, 2013 at 17:43 UTC ( #1029939=perlquestion: print w/ replies, xml ) Need Help??
zoya has asked for the wisdom of the Perl Monks concerning the following question:

Hey can anybody plz help. İ have my perl code like this, but İ am not getting the required output its giving html page but that doesnot contain the result page em not understanding kndly plz help. İ have tried it with so many ways.İn both ways <ı am not getting the results. Kindly plz help
use strict; use warnings; use WWW::Mechanize; use WWW::Mechanize::FormFiller; use HTML::Parser; use autodie qw/ open close /; use 5.012; my $browser = WWW::Mechanize->new(autocheck => 1); my $formfiller = WWW::Mechanize::FormFiller->new(); my $snp = "rs111"; my $response; my $URL ="http://snp-nexus.org/index.html"; $browser->get($URL); $response = $browser->post( $URL, [ 'query'=>'dbsnp', 'dbsnp_id'=> 'rs111', 'ensembl'=> 'ensembl', 'refseq'=>'refseq', 'ucsc'=>'ucsc', 'sift'=>'sift', 'polyphen'=>'polyphen', 'chb'=>'chb', 'chd'=>'chd', 'tfbs'=>'tfbs', 'consv'=>'consv', 'gwas'=>'gwas', 'indel'=>'indel', 'mirbase' =>'mirbase', 'gad'=>'gad', 'cnp' => 'cnp', 'vcf'=>'txt', 'value'=>'Run', ] ); print $browser-> content();
use strict; use warnings; use WWW::Mechanize; use WWW::Mechanize::FormFiller; use HTML::Parser; use autodie qw/ open close /; use 5.012; my $browser = WWW::Mechanize->new(autocheck => 1); my $formfiller = WWW::Mechanize::FormFiller->new(); my $snp = "rs111"; my $response; my $resp; $browser->get("http://snp-nexus.org/index.html"); $browser->form_name ('snpnexus'); $browser->select('query', 'dbsnp'); $browser->field('dbsnp_id', 'rs111'); $browser->tick('ensembl', "ensembl"); $browser->tick('refseq','refseq'); $browser->tick('ucsc','ucsc'); $browser->tick("sift",'sift'); $browser->tick("polyphen",'polyphen'); $browser->tick("chb",'chb'); $browser->tick("chd",'chd'); $browser->tick("tfbs",'tfbs'); $browser->tick("consv",'consv'); $browser->tick("gwas",'gwas'); $browser->tick("indel",'indel'); $browser->tick("mirbase" ,'mirbase'); $browser->tick('gad','gad'); $browser->tick('cnp' , 'cnp' ); $browser->submit('snpnexus','Run');

Comment on Perl Mechanize
Select or Download Code
Re: Perl Mechanize
by choroba (Abbot) on Apr 22, 2013 at 22:18 UTC
    The page contains some javascript. It might be possible that the page cannot be submitted without interpreting it. In such a case, you might be more lucky with WWW::Mechanize::Firefox.

    Moreover, checking the documentation of WWW::Mechanize, I noticed that $browser->submit takes no parameters and returns a HTTP::Response object. Specifying

    value => 'Run'
    is debatable as well, since the button is not called "value" and its value is "RUN", not "Run".
    لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      Thank you for the answer, i am still having troubles, unable to install mechanize firefox and secondly i change the run to RUN but still same output, can u plz explain me further

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1029939]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (13)
As of 2014-10-20 12:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (75 votes), past polls