PHP code example of addwiki / mediawiki-api-base
1. Go to this page and download the library: Download addwiki/mediawiki-api-base library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
addwiki / mediawiki-api-base example snippets
use \Addwiki\Mediawiki\Api\Client\Auth\UserAndPassword;
use \Addwiki\Mediawiki\Api\Client\Action\MediawikiApi;
$auth = new UserAndPassword( 'username', 'password' );
$api = MediawikiApi::newFromPage( 'https://en.wikipedia.org/wiki/Berlin', $auth );
$purgeRequest = FluentRequest::factory()->setAction( 'purge' )->setParam( 'titles', 'Berlin' );
$api->postRequest( $purgeRequest );