PHP code example of attus / mediawikiapi

1. Go to this page and download the library: Download attus/mediawikiapi 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/ */

    

attus / mediawikiapi example snippets


$api = new Api('https://de.wikipedia.org');
$page = $api->getPage('Geschichte der Kölner Straßenbahn');
$content = $page->getContent();
$url = $page->getUrl();

$api = new Api('https://de.wikipedia.org');
$image = $api->getImage('File:KVB4076_Severinsbruecke.jpg');
$pageUrl = $image->getPageUrl();
$user = $image->getImageUser();

$api = new Api('https://de.wikipedia.org');
$image = $api->getImage('File:KVB4076_Severinsbruecke.jpg');
$url = $image->getImageUrl(1920);