require './inc/config.inc.php'; require './inc/header.php'; try { $m = new YahooMessageArchiver(TRUE); } catch (OauthException $e) { echo "ERROR: Response: " . $e->lastResponse . PHP_EOL; exit; } // @todo make output prettier instead of print_r() everywhere try { $info = $m->getStoredInfo(); echo '<h3>Stored authentication information</h3>', PHP_EOL; echo '<p>GUID of user: '******'xoauth_yahoo_guid'], '</p>', PHP_EOL; echo '<p>Additional information is saved.</p>'; echo '<h3>All leagues you have played in</h3>', PHP_EOL; $ids = $m->getLeagueIds(FALSE); echo '<dl>'; foreach ($ids as $id) { // @todo A few are missing this, research this if (FALSE === strpos($id['url'], 'http://')) { $id['url'] = 'http://football.fantasysports.yahoo.com' . $id['url']; } echo '<dt><a href="', $id['url'], '">', $id['name'], '</a></dt>', PHP_EOL; echo '<dd>League Key: ', $id['league_key'], ' with ', $id['num_teams'], ' teams</dd>', PHP_EOL; // @todo Somtimes an empty object, research this, because league has not started? What does 'update' mean? $time = $id['league_update_timestamp']; if (is_object($time)) { $time = 'unknown'; } else { $time = date('F d, Y', $id['league_update_timestamp']); }
<?php require './inc/config.inc.php'; require './inc/header.php'; try { $m = new YahooMessageArchiver(TRUE); } catch (OauthException $e) { echo 'ERROR: Response: ', $e->lastResponse, PHP_EOL; exit; } $ids = $m->getLeagueIds(TRUE); if (!$ids) { echo 'Error: Unable to find league ids for you.', PHP_EOL; exit; } if (isset($_GET['a']) && $_GET['a'] === '1' && isset($_GET['lk'])) { echo 'Hello, I am inserting messages now. ', PHP_EOL; $count = 0; $data = $m->getMessages(1, 200, $_GET['lk']); foreach ($data->league->messages->message as $message) { if ($m->insertMessage($_GET['lk'], $message)) { $count++; } else { // @todo :) echo 'FAIL', PHP_EOL; } } echo 'I inserted ', $count, ' messages', PHP_EOL; } $linfos = $m->getLeagueInfo($ids); // @todo reduce number of rest calls