How to make a PHP request

From MediaWiki.org
Jump to: navigation, search
Tools clipart.png This page is part of the MediaWiki API documentation.
Language: English  • Français
MediaWiki API

Quick overview:

[edit] How to make a request in PHP

For a beginner in wikimedia development, this link is the most important:

API:Calling_internally

And all options can be find here

action=edit

And here:

API

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());
Personal tools
Namespaces

Variants
Actions
Navigation
Support
Download
Development
Communication
Print/export
Toolbox