Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Wikipedia: Wikitech

API (query action) ( mediawiki - 1.12 )

 

 

Wikipedia wikitech RSS feed   Index | Next | Previous | View Threaded


malagutidomp at hotmail

Nov 3, 2009, 9:49 AM

Post #1 of 3 (198 views)
Permalink
API (query action) ( mediawiki - 1.12 )

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/
_______________________________________________
Wikitech-l mailing list
Wikitech-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


jan at jans-seite

Nov 3, 2009, 10:26 AM

Post #2 of 3 (177 views)
Permalink
Re: API (query action) ( mediawiki - 1.12 ) [In reply to]

Moved to mediawiki-api list
(https://lists.wikimedia.org/mailman/listinfo/mediawiki-api)

Viele Grüße
Jan

-----Ursprüngliche Nachricht-----
Von: wikitech-l-bounces[at]lists.wikimedia.org
[mailto:wikitech-l-bounces[at]lists.wikimedia.org] Im Auftrag von javi bueno
Gesendet: Dienstag, 3. November 2009 18:50
An: wikitech-l
Betreff: [Wikitech-l] API (query action) ( mediawiki - 1.12 )


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/
_______________________________________________
Wikitech-l mailing list
Wikitech-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


_______________________________________________
Wikitech-l mailing list
Wikitech-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l


roan.kattouw at gmail

Nov 3, 2009, 10:29 AM

Post #3 of 3 (177 views)
Permalink
Re: [Mediawiki-api] API (query action) ( mediawiki - 1.12 ) [In reply to]

2009/11/3 Jan Luca <jan[at]jans-seite.de>:
> "unknown_action: Unrecognised value for parameter 'action'"
>
> I don't kinow if I am doing anything wrong.
>
The wiki you're querying doesn't allow anonymous users to read, you
need to log in for that. In MW 1.12, the API simply pretends
action=query doesn't exist in that case. Later versions of MW give a
clearer error message.

Roan Kattouw (Catrope)

_______________________________________________
Wikitech-l mailing list
Wikitech-l[at]lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Wikipedia wikitech RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.