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=php.
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=0e72e13613a9408646cae5aa1a630d0a+\&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)