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 echo '<dl>'; foreach ($linfos->league as $linfo) { $mcount = $m->getMessageCount($linfo->league_key);