On Fri, 23 Jan 2004, bzzt wrote:
I'm trying to log on to this site (www.thecityvibe.com/forum/) with the
followin script but doesn't seem to succeed. Anyone knows what the problem
might be?
I dont have time to test this from command line, but heres one possible
head scratching solution. I dont know why this works, but i have MANY
sites on which i have to do this. Regular form submits silently fail,
usually reloading the same page i was just on. when i do this trivial
(but explicit) change, they work.
basically i manually set the form action... to the same thing it was
already set to. and voila, stuff starts working. Ill edit your version
below to show you what i mean.
if that doesnt work, try using a click() instead of a submit().
matt
#!/usr/local/ActivePerl-5.6/bin/perl -w
use warnings;
use strict;
use WWW::Mechanize;
my $agent = WWW::Mechanize->new();
$agent->get('http://www.thecityvibe.com/forum/');
die "Can't even get the home page: ", $agent->response->status_line
unless $agent->success;
# form isnt playing nice for unknown reasons
# so we manually set action to whatever it already was
my $form = $agent->current_form();
my $uri =
URI->new("http://www.thecityvibe.com/whatevertheformactionwas");
$form->action($uri);
$form->method("POST");
$agent->field(username => "vagelis");
$agent->field(password => "vagelis");
$agent->submit();
#print $agent->content(),"\n";
#print $agent->uri();
--
gedanken