I'm using the Zend Framework HTTP client library to make an edit request to the MediaWiki API, as follows:
<?php
// Instantiate the client object.
require_once 'Zend/Http/Client.php';
$client = new Zend_Http_Client($apiUrl);
// Get necessary information.
$title = 'Testpage';
$text = 'Æneas Mackintosh';
$basetimestamp = '2009-09-15T15:45:50Z';
$token = '6c9600319ea3a1188d4542cd3e1443c7+\';
// Edit the page.
$client->setParameterPost('action', 'edit');
$client->setParameterPost('title', $title);
$client->setParameterPost('text', $text);
$client->setParameterPost('basetimestamp', $basetimestamp);
$client->setParameterPost('token', $token);
// Make the request.
$client->request('POST');
?>
After editing, the resulting wiki page should contain "Æneas Mackintosh" (note the AE ligature); instead it contains "�neas Mackintosh". I suspect that this is a MediaWiki API bug, since the POST request is what appears to be correctly formatted:
action=edit&title=Testpage&text=%C6neas+Mackintosh&basetimestamp=2009-09-15T15%3A45%3A50Z&token=6c9600319ea3a1188d4542cd3e1443c7%2B%5C
Has any one else had issues with special characters? Any solutions?
My configuration:
MediaWiki 1.15.1
Zend Framework 1.9.2
PHP 5.2.6-3ubuntu4.2
Thanks,
Jim
Anybody know what I am doing wrong here? API Login doesn't seem to
work if I specify format=xml, but does work with the default (html)
format. I *am* using the POST method. The username and password
contain no odd characters so it almost certainly isn't a urlencoding
problem.
I have also tried this with Wikimedia Commons login with the same result.
The following is a shell session using the lynx browser to illustrate
the problem. Sensitive data has been blanked out. The second browser
invocation is identical to the first except for "&format=xml", but
instead of returning xml it returns only blank lines.
tony@home:~$ lynx -post-data http://en-wikipedia.org/w/api.php
action=login&lgname=USERNAME&lgpassword=PASSWORD
---
You are looking at the HTML representation of the XML format.
HTML is good for debugging, but probably is not suitable for your
application.
See [1]complete documentation, or [2]API help for more information.
<?xml version="1.0"?>
<api>
<login result="Success" lguserid="XXX" lgusername="USERNAME"
lgtoken="TOKEN" cookieprefix="enwiki" sessionid="SESSIONID" />
</api>
References
1. http://www.mediawiki.org/wiki/API
2. http://en.wikipedia.org/w/api.php
tony@home:~$ lynx -post-data http://en-wikipedia.org/w/api.php
action=login&lgname=USERNAME&lgpassword=PASSWORD&format=xml
---
tony@home:~$
Hello all,
First of all, thanks so much for putting together this amazing
resource for folks to use! I'm an artist and have been working on a
project exploring sort of "hidden pathways" through Wikipedia.
I've been able to successfully query a list of all links in the main
article namespace (I hope I'm using the terms right here). The
problem is that I need the links in order of appearance, not
alphabetical order.
Is this possible? Maybe I'm missing something simple here?
Thanks very much!
Jeff Thompson
www.jeffreythompson.org