'error' => {
'code' => 'badtoken',
'*' => 'See http://somehost.got.internal.net/mediawiki/api.php for API usage',
'info' => 'Invalid token'
}
####
sub post {
my $query = shift @_;
print Dumper $client;
$client->POST($api, $query);
print "\$client->POST($api, $query)\n";
if ( $client->responseCode() == 200 ) {
print "Got Data OK, decoding ... " if $debug;
print Dumper $client->responseContent() ;
my $data = $JSON->decode( $client->responseContent() );
print Dumper $data;
return $data;
}
else {
print "Failed with code $client->responseCode()\n";
print Dumper $client->responseContent();
}
}
##
##
random@gotsvl1140:~> ./LookupsToWiki.pl
$VAR1 = bless( {
'_config' => {
'host' => 'http://somehost.got.internal.net',
'useragent' => bless( {
'proxy' => {},
'timeout' => 180,
'ssl_opts' => {
'verify_hostname' => 1
},
'handlers' => {
'response_header' => bless( [ {
'owner' => 'LWP::UserAgent::parse_head',
'callback' => sub { "DUMMY" },
'm_media_type' => 'html',
'line' => '/usr/lib/perl5/vendor_perl/5.18.2/LWP/UserAgent.pm:683'
} ], 'HTTP::Config' )
},
'protocols_forbidden' => undef,
'max_redirect' => 7,
'use_eval' => 1,
'max_size' => undef,
'show_progress' => undef,
'local_address' => undef,
'def_headers' => bless( {
'user-agent' => 'REST::Client/273'
}, 'HTTP::Headers' ),
'no_proxy' => [],
'protocols_allowed' => undef,
'requests_redirectable' => [
'GET',
'HEAD'
]
}, 'LWP::UserAgent' ) }
}, 'REST::Client' );
$client->POST(/mediawiki/api.php, action=login&lgname=Marvin&lgpassword=volvo123&format=json)
$VAR1 = '
MediaWiki API help - Monitoring Services
","wgRelevantArticleId":0,"wgRequestId":"WwLj2gr-QFMAAE7vrZwAAAAF","wgIsProbablyEditable":false,"wgVisualEditor":... Plenty more html here ...