kaloyanivanov
3/25/2017 - 10:12 PM

Parse #Wikipedia Data

Parse #Wikipedia Data

<?php 
$url = 'http://en.wikipedia.org/w/api.php?action=parse&page=Ian_McKellen,_roles_and_awards&format=json&prop=text&section=2';
$ch = curl_init($url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_USERAGENT, "TestScript"); $c = curl_exec($ch);

$json = json_decode($c);

$content = $json->{'parse'}->{'text'}->{'*'};

    print $content; 


?>