Jools,
Thanks for taking a look at my post. Is there a way to determine the location of api.php on a given wiki server? I tried out your code against my internal wiki page but it fails as below:
$perl wiki.pl Error code: 2 301 Moved Permanently : error occurred when accessing http://foo:bar@wiki.eng.vmware.com/api.php after 1 attempt(s) at /usr/local/lib/perl5/site_perl/5.10.0/MediaWiki/API.pm line 354 MediaWiki::API::api('MediaWiki::API=HASH(0x22bde88)', 'HASH(0x22e6b08)') called at /usr/local/lib/perl5/site_perl/5.10.0/MediaWiki/API.pm line 513 MediaWiki::API::get_page('MediaWiki::API=HASH(0x22bde88)', 'HASH(0x2837568)') called at wiki.pl line 21
Died at wiki.pl line 12.
On Mon, Jun 7, 2010 at 10:29 AM, Jools Wills buzz@exotica.org.uk wrote:
A working example with http auth.
#!/usr/bin/perl use strict; use warnings; use MediaWiki::API;
my $mw = MediaWiki::API->new();
sub on_error() { print "Error code: " . $mw->{error}->{code} . "\n"; print $mw->{error}->{stacktrace}."\n"; die; }
$mw->{config}->{api_url} = 'http://hello:world@testwiki.exotica.org.uk/mediawiki/api.php'; $mw->{config}->{on_error} = &on_error;
use Data::Dumper; print Dumper $mw->get_page( { title => 'Main Page' } );
Mediawiki-api mailing list Mediawiki-api@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-api