Skip to content

Instantly share code, notes, and snippets.

@yec
Created March 26, 2012 11:55
Show Gist options
  • Save yec/2204624 to your computer and use it in GitHub Desktop.
Save yec/2204624 to your computer and use it in GitHub Desktop.
Export site
#!/usr/bin/perl -w
use WWW::Mechanize;
$site = 'http://site.com/';
$username = 'username';
$password = 'password';
my $m = WWW::Mechanize->new();
$loginurl = $site;
$m->get($loginurl);
my $fields = {
'username' => $username,
'password' => $password,
};
my $r = $m->submit_form(form_number => 1, fields=>$fields);
die "Couldn't submit form" unless $r->is_success;
$exporturl = $site.'index.php?a=83';
$m->get($exporturl);
my $export = $m->submit_form(form_number => 1);
die "Couldn't submit form" unless $export->is_success;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment