2010/4/12 Claes Lindvall <cla...@ekvagen.com>:
> But if I run it from my webbrowser I get the result:
>
> api.php?action=query&generator=categories&titles=Page1
>
> <?xml version="1.0" encoding="utf-8"?>
> <api>
>   <query>
>     <pages>
>       <page pageid="5" ns="14" title="Category:Teologi" />
>     </pages>
>   </query>
> </api>
>
> The Script:
> use MediaWiki::API;
> binmode STDOUT, ':utf8';
> my $mw = MediaWiki::API->new();
> $mw->{config}->{api_url} = 'http://192.168.10.1/wiki3/api.php';
> # log in to the wiki
> $mw->login( { lgname => 'WikiSysop', lgpassword => 'xxxxxx' } )
>         || die $mw->{error}->{code} . ': ' . $mw->{error}->{details};
>
> if ( my $ref = $mw->api( { action => 'query', generator => 'categories',
> titles => 'Page1'} )) {
>          print $ref->{query}->{pages}->{page}->{ns};
> }
>
> What is wrong with my script (or me)?
I'm not very familiar with MediaWiki::API, but I think it may need a
certain format= parameter to work; the result you posted seems to
result from not passing a format= parameter.

Roan Kattouw (Catrope)

_______________________________________________
Mediawiki-api mailing list
Mediawiki-api@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api

Reply via email to