Unable to parse Wikidata URL

97 views Asked by At

I'm trying to analyze data from the Wikidata API, but I keep getting timed out when running the var_dump function. Please see my code below:

<html>
<body>
<h2>Search</h2>
<form method="post">
Search: <input type="text" name="q" value="Google"/>
<input type="submit" value="Submit">
</form>

<?php
if (isset($_POST['q'])) {
$search = $_POST['q'];

$url_2 = "http://www.wikidata.org/w/api.php?
action=wbgetentities&sites=enwiki&titles=$search&languages=en";
$res_2 = file_get_contents($url_2);
$data_2 = json_decode($res_2);
var_dump($data_2);

}
exit;

?>

</body>
</html>

I click Submit however get: Fatal error: Maximum execution time of 30 seconds exceeded in... Any other suggestions to analyze the data? Thanks.

0

There are 0 answers