Hi, I'm trying to get the content of an article through API ( PHP code ) .
I logged through POST request, but when I tried to do the query action I saw the following
message :
"unknown_action: Unrecognised value for parameter 'action'"
I don't kinow if I am doing anything wrong.
This is my code :
<?php
$url = "http://localhost/wiki/api.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
$data = array('action' => 'login', 'lgname' =>
'myuser', 'lgpassword' => 'mypassword');
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
$result= curl_exec ($ch);
curl_close ($ch);
$url = "http://localhost/wiki/api.php";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POST, 1);
$data = array('action' => 'query', 'prop' =>
'revisions', 'meta' => 'siteinfo' , 'titles' =>
'Main Page' , 'rvprop' => 'user|comment|content';
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
$result= curl_exec ($ch);
curl_close ($ch);
print $result;
?>
anybody knows what I am doing wrong ?
Thanks in advance.
Javier Bueno.
_________________________________________________________________
Date una vuelta por Sietes y conoce el pueblo de los expertos en Windows 7
http://www.sietesunpueblodeexpertos.com/