Right I think I know where this error is coming up now. I still tried the
approach in XML and unfortunately it was the same story with a 1 being
returned. Also my script throws out some output so here it is;
POST Data: action=login&lgname=***&lgpassword=***&format=xml
POST Result: <?xml version="1.0"
result="Success" lguserid="***" lgusername="***"
GET Data: action=query&intoken=edit&titles=BotTest&prop=info&format=xml
GET Result: <?xml version="1.0"
ns="0" title="BotTest" missing=""
POST Result: 1
Just to clarify that the data lines show any parameters being passed while
the result lines show the XML responses.
Onto where the error is actually occurring. Hopefully I am not going too
off-topic on this list. I notice in my PHP error log that some of my
extension functions are dying with a fatal error when the edit request
occurs. I know that these functions all run successfully when a standard
request from a browser is made.
The specific error is that it appears that wiki global $wgTitle does not
have a value in it. Is there a way to check where the request originates
from, be it the browser or a request through the API. If I could ascertain
this then I would be able to instruct my extension to not register any
functions which rely on some of the wiki globals being set.
[mailto:firstname.lastname@example.org] On Behalf Of Roan Kattouw
Sent: 30 September 2008 15:00
To: MediaWiki API announcements & discussion
Subject: Re: [Mediawiki-api] Problem with action=edit using PHP
Marcus Ramsden schreef:
I have put the edit token through the php urlencode function which
the token to the following format,
Looks good. Of course the built-in urlencode() function is the way to
go, hadn't thought about that when I wrote my first message.
This has stopped the invalid token error being sent.
That probably means it's correct.
But now there is
Rather than the response being the standard response the API is responding
only with a 1. As opposed to the appropriate PHP data structure.
weird. Please do the following things:
* check whether the edit got through;
* try using a different format like XML or JSON and see whether they
return the right data;
* tell me which wiki you're running this bot against (if it's not
Wikipedia or another WMF wiki, also include the version you see in
Roan Kattouw (Catrope)
Mediawiki-api mailing list