I need some help - I've implemented the API using CodeIgniter for a
clients site and everything works on the site except for the wiki pages,
which are sluggish.
Here is my controller which lists the function calls being made and in
what order:
http://pastebin.com/m4021c1a7
And here is my model where the actual API calls are made:
http://pastebin.com/dd7c504c
The api.php file exists on the same server that is making the calls, so
it should be instant but the pages are so very slow, and only in the
instance of using the MW API.
Any help or insight anybody could give would be MUCH appreciated.
- Mark
Hello ,
i am trying to develop a mobile wikipedia product which utilize the GPS
data. I noticed that google maps have a button "more -> wikipedia" which
will show wikipedia articles near a specific location . I am curious how
that works?
Any tips/answers are highly appreciated. Thanks.
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
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
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 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
The unserialized response from the API is:
Array
(
[error] => Array
(
[code] => badtoken
[info] => Invalid token
)
)
Any insight on this would be greatly appreciated.
Marcus Ramsden
---
Marcus Ramsden
Technical Project Assistant
Learning Societies Laboratory, Electronics and Computer Science
University of Southampton
3069, Building 32, Highfield Campus
Southampton SO17 1BJ
www.southampton.ac.uk/ecs
Are there any plans to provide API hooks for getting the contents of the
remaining Special: pages? We have list=allpages for Special:AllPages,
list=allcategories for Special:Categories and list=recentchanges for
Special:RecentChanges, for example (and some others), but at present there
is no way of accessing the contents of many pages such as:
Special:BrokenRedirects
Special:CrossNamespaceLinks
Special:DeadendPages
Special:DoubleRedirects
Special:LongPages
Special:AncientPages
Special:LonelyPages
Special:FewestRevisions
Special:WithoutInterwiki
Special:ProtectedPages
Special:ProtectedTitles
Special:ShortPages
Special:UncategorizedCategories
Special:UncategorizedImages
Special:UncategorizedPages
Special:UncategorizedTemplates
Special:UnusedCategories
Special:UnusedImages
Special:UnusedTemplates
Special:WantedCategories
Special:WantedFiles
Special:WantedPages
Special:MostLinkedCategories
Special:MostImages
Special:MostLinked
Special:MostLinkedTemplates
Special:MostCategories
Special:MostRevisions
Granted, some of these are more useful than others, but the information is
accessible via the UI, so why not via the API?
Russ
I need to load up a few hundred MW pages with text and images.
Looking at http://en.wikipedia.org/w/api.php, I find several
tools for getting information about images, but nothing for
uploading them:
* prop=images (im) *
* prop=imageinfo (ii) *
* list=allimages (ai) *
* list=imageusage (iu) *
Am I missing something?
More generally, are there any tools other than pywikipediabot
and the MW API that I should look into?
-r
--
http://www.cfcl.com/rdm Rich Morin
http://www.cfcl.com/rdm/resume rdm(a)cfcl.com
http://www.cfcl.com/rdm/weblog +1 650-873-7841
Technical editing and writing, programming, and web development