Im not getting the data correctly. this just gave me nothing!?
function getUser() {
$json = file_get_contents('http://onleague.stormrise.pt:8031/OnLeagueRest/resources/onleague/Social/WallEntries?id_user=a7664093-502e-4d2b-bf30-25a2b26d6021&count=3');
$data = json_decode($json, TRUE);
$user = array();
foreach($data['data']['item'] as $item) {
$user[] = $item;
}
foreach($user as $v)
{
echo $v['userID']." ".$v['userName'].'<br />';
}
}
getUser();
Your
returns not a valid
jsonstring that can be converted into array byjson_decode. If you look inside, you will find substrings like:2011-05-21T00:00:00+01:00here should be enclosed in ” to give you a validjsonstring that may be parsed byjson_decode. So, your$datais nowNULL(that’s whatjson_decodereturned)