Stack Overflow archive
1 scoreaccepted

Read JSCON file with PHP

score
1
question views
59
license
CC BY-SA 3.0

It is called JSON, not JSCON. The code you posted is JavaScript, not PHP.

Here is an example of how you could read the JSON you provided with PHP:

xml
<?php
    $result = file_get_contents("http://nhlwc.cdnak.neulion.com/fs1/nhl/league/teamroster/ANA/iphone/clubroster.json");
    $json = json_decode($result);
    foreach ($json->goalie as $player) {
        echo $player->name . '</br>';
    }
?>

This will print each goalie's name.

Originally posted on Stack Overflow. Public user contributions are licensed under Creative Commons Attribution-ShareAlike.