require './inc/header.php'; // @todo add proper error reporting if (empty($_VARS['week_num']) || empty($_VARS['league_key'])) { echo 'Error: A week number and league key is required for matchup information'; exit; } try { $m = new YahooFantasyAPI(TRUE); } catch (OauthException $e) { echo 'ERROR: Response: ', $e->lastResponse, PHP_EOL; exit; } $query = "league/{$_VARS['league_key']}/scoreboard;week={$_VARS['week_num']}/matchups/teams/roster;week={$_VARS['week_num']}/players/stats;type=week;week={$_VARS['week_num']}"; // For single team // $query = "team/{$team_key}/roster;week={$week_num}/players/stats;type=week;week={$week_num} $minfo = $m->retrieve($query); // @todo fix questionable error handling if (empty($minfo)) { echo "FAIL"; exit; } echo '<h1>Matchup information for week ', $minfo->league->scoreboard->week, '</h1>'; // @todo remove this hack // @todo show more info foreach ($minfo->league->scoreboard->matchups->matchup as $key => $values) { $team_name_0 = $values->teams->team[0]->name; $team_name_1 = $values->teams->team[1]->name; // @todo Assuming one manager for now $team_nick_0 = $values->teams->team[0]->managers->manager->nickname; $team_nick_1 = $values->teams->team[1]->managers->manager->nickname; $team_score_0 = $values->teams->team[0]->team_points->total;
echo PHP_SELF; ?> ?command=SELECT * FROM fantasysports.leagues where use_login=1 and game_key='359'">run</a>]</li> </ul> <form action="<?php echo PHP_SELF; ?> " method="GET"> <textarea name="command" cols="80" rows="10"><?php echo isset($_GET['command']) ? $_GET['command'] : ''; ?> </textarea> <input type="submit" name="submit" value="submit REST command"> <input type="hidden" name="action" value="run"> </form> <?php if (isset($_GET['command'])) { try { $out = $m->retrieve(trim($_GET['command'])); print "<pre>"; print_r($out); } catch (OAuthException $e) { echo '<pre>'; echo 'Exception caught!', PHP_EOL; echo 'Response: ', $e->lastResponse, PHP_EOL; print_r($e); } } require './inc/footer.php';