How to make a PHP request
From MediaWiki.org
| This page is part of the MediaWiki API documentation. |
| Language: | English • Français |
|---|
Quick overview:
- Quick start guide
- FAQ
- Tutorial
- Formats
- Error reporting
- Restricting usage
- Authentication
- Queries
- Search suggestions
- Expanding templates and rendering
- Purging pages' caches
- Parameter information
- Changing wiki content
- Watchlist feed
- Extensions
- Using the API in MediaWiki and extensions
- Miscellaneous
- Implementation
- Client code
[edit] How to make a request in PHP
For a beginner in wikimedia development, this link is the most important:
And all options can be find here
And here:
And the code to create a page is:
global $wgUser;
echo "<p>".$token = $wgUser->editToken();
$params = new FauxRequest( array(
'action'=>'edit',
'title'=>'Talk:Main_Page',
'section'=>'new',
'summary'=>'Hello%20World',
'text'=>'Hello%20everyone!',
'watch'=>'',
'basetimestamp'=>'2008-03-20T17:26:39Z',
'token'=>$token,
));
$enableWrite = true; // This is set to false by default, in the ApiMain constructor
$api = new ApiMain( $params, $enableWrite );
$api->execute();
echo "<p>";
print_r($data = & $api->getResultData());