I have to get a table in my website. And have to get the data for this table from "http://west.basketball.nl/db/json/stand.pl?szn_Naam=2014-2015&cmp_ID=373" I've tried a lot of thing but nothing works....
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript"
src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
</head>
<body>
<?php
$json=file_get_contents("http://west.basketball.nl/db/json
/stand.pl?szn_Naam=2014-2015&cmp_ID=373");
$data = json_decode($json);
if (count($data)) {
// Open the table
echo "<table>";
// Cycle through the array
foreach ($data as $stand) {
// Output a row
echo "<tr>";
echo "<td>$afko</td>";
echo "<td>$positie</td>";
echo "</tr>";
}
// Close the table
echo "</table>";
}
?>
</body>
</html>
Ok first thing to do when getting data from an external source is to understand what is being returned.
So do
Result:
So now you know you are dealing with an OBJECT and not scalar values or an array.
So try this code:-