I am trying to Get JSON data using PHP from another page, but its showing up in a weird formation and beside eachother on a single line.
I tried to use json_decode method, but didnt work for me! But how can I make it show up in the correct formation showen below:
This is how I want it to show up, which it does on the Main Page:
{
"games": "pacman",
"level":"2",
"icon":"LINK HERE",
"topscorer":"3134000",
"nextlevel":"3",
"players":[ 21322,
43131,
84993,
8212,
501421,
7832126 ]
}
And this is what I get:
{ "games": "pacman", "level":"2", "icon": "LINK HERE", "topscorer": "3134000", "nextlevel": "3", "players": [ 21322, 43171, 84993, 8222, 501421, 7832126 ] }
My PHP Code:
<?php
$page = file_get_contents('WEBSITE-URL-HERE');
echo $page;
?>
Is there any way to make it show up in correct formation just like the one above? Any answer could be help full in this case. Thank you