I have been trying to call a JSON feed using PHP the code I have used so far is
$json = file_get_contents( 'http://football-api.com/api/?Action=standings&APIKey=********' );
$team_data = json_decode($json);
<?php
echo $team_data->teams[0]->stand_team_name;
echo $team_data->teams[1]->stand_team_name;
echo $team_data->APIRequestsRemaining;
?>
However the first 2 echos don't work but the 3rd one does...
A snippet from the API...
{
APIVersion: 1,
APIRequestsRemaining: 1000,
DeveloperAuthentication: "TRUE",
teams: [
{
stand_id: "12049092",
stand_competition_id: "1204",
stand_season: "2014/2015",
stand_round: "29",
stand_stage_id: "12041081",
stand_group: "",
stand_country: "England",
stand_team_id: "9092",
stand_team_name: "Chelsea",
stand_status: "same",
stand_recent_form: "DWDWW",
stand_position: "1",
stand_overall_gp: "28",
stand_overall_w: "19",
stand_overall_d: "7",
stand_overall_l: "2",
stand_overall_gs: "58",
stand_overall_ga: "23",
stand_home_gp: "14",
stand_home_w: "11",
stand_home_d: "3",
stand_home_l: "0",
stand_home_gs: "28",
stand_home_ga: "6",
stand_away_gp: "14",
stand_away_w: "8",
stand_away_d: "4",
stand_away_l: "2",
stand_away_gs: "30",
stand_away_ga: "17",
stand_gd: "35",
stand_points: "64",
stand_desc: "Promotion - Champions League (Group Stage)"
},
Any ideas why it is not showing up?
print_r($team_data)?$team_data = ..;