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"
encoding="utf-8"?><api><login
result="Success" lguserid="***" lgusername="***"
lgtoken="d6ef5e4f6baaa4a7b3468a1eac5160b3" cookieprefix="ibwiki_"
sessionid="***" /></api>
GET Data: action=query&intoken=edit&titles=BotTest&prop=info&format=xml
GET Result: <?xml version="1.0"
encoding="utf-8"?><api><query><pages><page
ns="0" title="BotTest" missing=""
edittoken="771ceb39a33469b2a87873ef26b75b82+\"
/></pages></query></api>
POST Data:
action=edit&title=BotTest&summary=Page+created+by+the+IBWikiBot.&text=This+i
s+some+test+content+added+by+the+IBWikiBot.&recreate=1&token=771ceb39a33469b
2a87873ef26b75b82%2B%5C¬minor=1&bot=1&format=xml
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.
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 15:00
To: MediaWiki API announcements & discussion
Subject: Re: [Mediawiki-api] Problem with action=edit using PHP
Marcus Ramsden schreef:
Hi Roan,
I have put the edit token through the php urlencode function which
converts
the token to the following format,
771ceb39a33469b2a87873ef26b75b82%2B%5C.
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
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.
That's very
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
Special:Version)
Roan Kattouw (Catrope)
_______________________________________________
Mediawiki-api mailing list
Mediawiki-api(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api