Re: WWW::Mechanize problems

Peter Stevens <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.lwp
Message-ID <[email protected]>
Hi Sebastian,

It's sometimes hard to know exactly what a web page is reacting to when 
you post something to the page. Sometimes it's looking for the button, 
maybe it's looking for a hidden variable. (for more details, see

I would suggest using Tamper Data ( http://tamperdata.mozdev.org/ ) to 
look at exactly what data is being transmitted to the host. Then look at 
what $mech wants to send. (Look at headers and posted variables.) In 
general if you can get the http requests to be identical, then you 
should get identical responses from the server.

Cheers,

Peter

ChaosMK2 wrote:

> Hello,
>
> I have a problem with WWW::Mechanize that I cant solve. I am posting 
> to a site but apparently I get always to the same original site.
>
> my $mech = WWW::Mechanize->new(stack_depth => 1);
> ...
> my $url = URI->new("http://rna.tbi.univie.ac.at/cgi-bin/RNAfold.cgi");
> ...
> $mech->get($url);
> ...
> if($mech->success())
>            {
>                $mech->form_number(1);
>                $mech->set_fields(
>                            name        => "$names[$num]",
>                            Sequence    => "$lines[$num]",
>                            pffold        => "pf",
>                            Params        => "RNA",
>                            Temp        => "37",
>                            email        => '[email protected]'
>                         );
>                $mech->untick(toggles => "-4");
>                $mech->untick(toggles => "-d");
>                $mech->tick(toggles => "-noCloseGU");
>                $mech->tick(toggles => "-noLP");
>                $mech->untick(plot => "on");
>                $mech->untick(SVG => "on");
>                $mech->untick(SSview => "on");
>                $mech->click_button(value => "Fold it");
>                if($mech->success())
>                {... do something
>
> I never get to the next page. Arrays @nams and @lines are not empty. I 
> checked it with submit with some hardcoding for Sequence but there is 
> no chance to get past the original site. Do I anything wrong? I am 
> lost I am afraid. Thank you in advance for any advice.
>
> Sebastian
>

-- 
----------------------------------------------------------------------
Peter Stevens                                   Phone: +41 43 535 8517
www.MinuteWatcher.com                             Fax: +41 44 544 8392
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.