Folks,
I'm having some trouble editing a page with the MediaWiki API on 1.13.3.
I have used the following PERL code, which takes a page name and some
content and should add it to my wiki. This works almost flawlessly,
with the exception that instead of the content going to the page
specified in the title, it goes into a page called "Api.php".
sub add_wiki {
my $page = shift;
my $content = shift;
my $ua = LWP::UserAgent->new;
$ua->agent("Aquila bot/0.1");
$ua->credentials(
'wiki.example.com:443',
'Restricted Files',
$wikiuser => $wikipass
);
my %post;
$post{"format"} = "xml";
$post{"title"} = $page;
$post{"text"} = $content;
$post{"section"} = "0";
$post{"token"} = $edittoken;
$post{"action"} = "edit";
my $req = $ua->post($wikiaddurl, ,[ %post ]);
my $data;
if ($req->is_success == 1) {
$data = $req->content;
return("0", $data);
} else {
my $error = $req->status_line;
return("1", $error);
}
}
I have checked and the page name is being passed correctly to the
function. Am I missing something? I have checked the docs that I can
find, including the API documentation on the MediaWiki site but as far
as I can tell, all I need to do is pass title=name for the page name to
use?
Mike.