Jump to content

How do contain the results of this api request in one Div box.


SennNathan

Recommended Posts

I need to know how to contain the results of this api request in one Div box here is my code. I feel like this should work but when i test it wont work right.

<!DOCTYPE html>
<?php
$request = 'http://api.wolframalpha.com/v2/query?appid=YKAERX-QJJAE7L2G6&input=albert%20einstein&format=html';

$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_URL, $request);
$response = curl_exec($curl);
curl_close($curl);
$blank = '';
$remove = '/]]>/';
$display = preg_replace($remove, $blank, $response); 


?>
<html>
<head>
<style>
div.ex
{
width:500px;
padding:10px;
border:5px solid gray;
margin:0px;
}
</style>
</head>

<body>
<div class="ex">
<?php 
echo $display
?>
</div>

</body>
</html>


Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.