views:

209

answers:

2

I've been working on a php script to update mediawiki entries, however whenever I run it it doesn't seem to update the wiki at all and just returns the article page unedited.

I've included a section which logs into the wiki first and I've successfully read information off the wiki but I have not been able to update it.

Is there something I'm missing or better yet is there an existing php package which can be used to update a mediawiki.

thanks in advance,

sample code follows:

function curl_post_page($site, $post ) {
$headers = array();
$headers[] = 'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg';
$headers[] = 'Connection: Keep-Alive';
$headers[] = 'Content-type: application/x-www-form-urlencoded;charset=UTF-8'; 

//var_dump($post);
$cl = curl_init($site);
curl_setopt($process, CURLOPT_HTTPHEADER, $headers); 
curl_setopt($cl, CURLOPT_HEADER, true);
curl_setopt($cl, CURLOPT_VERBOSE, true);
curl_setopt($cl, CURLOPT_FAILONERROR, true); 
curl_setopt($cl, CURLOPT_POST, TRUE);
curl_setopt($cl, CURLOPT_POSTFIELDS, $post);
curl_setopt($cl, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($cl, CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT)");
curl_setopt($cl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cl, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($cl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($cl, CURLOPT_COOKIEFILE, "cookie.txt");
A: 

There are several client libraries available

Frank Farmer
A: 

Is the api writing enabled? ($wgEnableWriteAPI = false;) It is disabled by default for versions below 1.14.

Are you getting any errors back?

Adrian Archer