arrays - Mixing data from multiple JSON files -


i'm building project loads fantasy football stats of players. i'm using nfl.com's api , i'm stuck right now. while doing searching saw similar topics answered on stackoverflow, didn't quite fit needs.

here's links json files i'm using:

http://api.fantasy.nfl.com/v1/players/stats?stattype=seasonstats&season=2014&week=1&format=json http://api.fantasy.nfl.com/v1/players/stats?stattype=seasonstats&season=2014&week=2&format=json http://api.fantasy.nfl.com/v1/players/stats?stattype=seasonstats&season=2014&week=3&format=json

here's link unflattened version can see structure properly: http://codebin.org/view/89722b2e

as can see, each of links picking different week of season. name, position, , team need pull once, need pull weekly stats each json file each player. i'm not sure how go doing it.

this code i'm using:

$json = file_get_contents("http://api.fantasy.nfl.com/v1/players/stats?stattype=seasonstats&season=2014&week=1&format=json"); $data = json_decode($json); $path = $data->players;  <table class="table">     <thead>     <tr>         <th>name</th>         <th>team</th>         <th>position</th>         <th>season points</th>         <th>1</th>         <th>2</th>     </tr>     </thead>     <tbody>     <?php foreach ($path $player) {         $parts = explode(" ", $player->name);         $lastname = array_pop($parts);         $firstname = implode(" ", $parts);         $player->name = $lastname.", ".$firstname;     ?>         <tr>             <td><?php echo $player->name; ?></td>             <td><?php echo $player->teamabbr; ?></td>             <td><?php echo $player->position; ?></td>             <td><?php echo $player->seasonpts; ?></td>             <td><?php echo $player->weekpts; ?></td>             <td></td>         </tr>     <?php } ?>     </tbody> </table> 

the blank being saved week 2 points. appreciated.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

python - build a suggestions list using fuzzywuzzy -