Question

i'm trying to use wikipeida-API and get the contents(as HTML) of a page for example this one

i am trying with Sandbox but there is a misteke. In this page i'm writing San Francisco in Page section an it says The page you specified doesn't exist.Just like that.(click Make Request and see it)

what should i write in this page section.

Était-ce utile?

La solution

you should write San Francisco to Page. there is nothing wrong. wrong thing is sandbox itself. If you write San Francisco to page it gives you that url:

/w/api.php?action=parse&format=json&page=San%20Francisco

add en.wikipedia.org to it and go to page. See everything is fine.Sandbox gives you error cause it programmed wrong basically.

if you want that page as HTML:

<?php
$ip_data = json_decode(file_get_contents("http://en.wikipedia.org/w/api.php?action=parse&format=json&page=Los%20Angeles"), true);
?>


<html>
<body>
     <?php print_r($ip_data['parse']['text']['*'])  ?>
</body>
</html>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top