I am trying to get this to work but can't see where I'm going wrong. Can anyone assist?
<?php
$jsonurl = 'http://www.foxsports.com.au/internal-syndication/json/livescoreboard';
$json = file_get_contents($jsonurl,0,null,null);
$json_output = var_dump(json_decode($json,true));
echo $json_output
?>
Hint :
The initial JSON (stored in $json
variable) does NOT validate.
Code : (FIXED)
<?php
$jsonurl='http://www.foxsports.com.au/internal-syndication/json/livescoreboard';
$json = file_get_contents($jsonurl,0,null,null);
$json = strip_tags(str_replace("jQuery.fs['scoreboard'].data =","",$json));
$json_output = var_dump(json_decode($json,true));
echo $json_output;
?>
This will work. :-)
Your JSON source is not valid. You can try this validator http://jsonlint.com/