perl - What is the reason for the error "Failed to decode JSON" in MediaWiki::API? -
we have private mediawiki installation inside our company. based on daily builds on our source code, update wiki perforce labels people can use build labeled streamlined process. tried automate using perl scripts on windows server using mediawiki::bot , mediawiki::api.
use mediawiki::bot; use mediawiki::api; $mw = mediawiki::api->new(); $mw->{config}->{api_url} = 'http://somewiki/w/index.php/title#feature_list'; # log in wiki $mw->login({ lgname => 'username', lgpassword => 'password' || die $mw->{error}->{code} . ': ' . $mw->{error}->{details}; # list of articles in category $articles = $mw->list({ action => 'query', list => 'categorymembers', cmtitle => 'category:perl', cmlimit => 'max' }) || die $mw->{error}->{code} . ': ' . $mw->{error}->{details}; # , print article titles foreach (@{$articles}) { print "$_->{title}\n"; }
output:
2: failed decode json returned http://vaporwiki/w/index.php/executor#execu tor_feature_list decoding error: malformed json string, neither array, object, number, string or atom, @ charact er offset 0 (before "<!doctype html publi...") @ c:/perl/lib/mediawiki/api.pm l ine 398 returned data: <whole page data>
the api url wrong. try http://vaporwiki/w/api.php
.
Comments
Post a Comment