Hi Roan,
I have put the edit token through the php urlencode function which converts
the token to the following format, 771ceb39a33469b2a87873ef26b75b82%2B%5C.
This has stopped the invalid token error being sent. But now there is
another issue.
Rather than the response being the standard response the API is responding
only with a 1. As opposed to the appropriate PHP data structure.
Marcus
-----Original Message-----
From: mediawiki-api-bounces(a)lists.wikimedia.org
[mailto:mediawiki-api-bounces@lists.wikimedia.org] On Behalf Of Roan Kattouw
Sent: 30 September 2008 13:34
To: MediaWiki API announcements & discussion
Subject: Re: [Mediawiki-api] Problem with action=edit using PHP
Marcus Ramsden schreef:
Hi,
I am getting an issue using the edit action of the MediaWiki API.
Whenever I send an edit request I am getting an error response stating
badtoken. The question I have is which token is this referring to. Is
this referring to my cookie token which I have instructed curl to
store or is it referring to the edit token.
The badtoken error always refers to the edit token.
The login operation is given the following parameters using a POST
request;
action=login&lgname=<bot username>&lgpassword=<bot
password>&format=php
To obtain the token I am using the following parameters in a GET request ;
action=query&intoken=edit&titles=IBWikiBotTest&prop=info|revisions&format=ph
p.
The following parameters are then used as part of a POST request in
the attempt to create a new page;
action=edit&title=IBWikiBotTest&summary=Page created by the
IBWikiBot.&text=This is some test content added by the
IBWikiBot.&md5=e21e79d8ee8ee6b5038c9bac090decf1&bot&recreate&token=0e72e1361
3a9408646cae5aa1a630d0a+\\&format=php
Try removing the second backslash (you don't
need to escape backslashes
in URLs) and encoding the + as %2B (if you don't do that, it could end
up being converted to a space).
Roan Kattouw (Catrope)
_______________________________________________
Mediawiki-api mailing list
Mediawiki-api(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api