Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en-US">
- <head>
- <meta charset="UTF-8">
- <title>NHL Streams</title>
- </head>
- <body>
- <?php
- $sked = file_get_contents( 'http://live.nhl.com/GameData/SeasonSchedule-20132014.json' );
- $sked_json = json_decode( $sked );
- $todays_date = date( 'Ymd', time() );
- $output = '<ul>';
- foreach ( $sked_json as $game ) {
- $date = $game->est;
- $game_date = date( 'Ymd', strtotime( $date ) );
- if( $game_date != $todays_date ) {
- continue;
- }
- $game_id = substr( $game->id, -4 );
- $streams = file_get_contents( 'http://smb.cdnak.neulion.com/fs/nhl/mobile/feed_new/data/streams/2013/ipad/02_'.$game_id.'.json' );
- $streams_json = json_decode( $streams );
- $output .= '<li>';
- $output .= $game->a . ' @ ' . $game->h . ' - ' . date( 'g:i a', strtotime( $game->est) ) . ' EST';
- $output .= '<ul>';
- if( !isset( $streams_json->gameStreams->ipad->away->live ) ) {
- $output .= '<li>No streams available yet. Check back soon</li>';
- } else {
- $stream_a = $streams_json->gameStreams->ipad->away->live->bitrate0;
- $stream_h = $streams_json->gameStreams->ipad->home->live->bitrate0;
- $output .= '<li>' . $game->a;
- $output .= '<ul>';
- $output .= '<li>' . $stream_a . '</li>';
- $output .= '<li>' . preg_replace( '/ipad/i', '4500', $stream_a ) . '</li>';
- $output .= '<li>' . preg_replace( '/ipad/i', '3000', $stream_a ) . '</li>';
- $output .= '<li>' . preg_replace( '/ipad/i', '1600', $stream_a ) . '</li>';
- $output .= '</ul>';
- $output .= '</li>';
- $output .= '<li>' . $game->h;
- $output .= '<ul>';
- $output .= '<li>' . $stream_h . '</li>';
- $output .= '<li>' . preg_replace( '/ipad/i', '4500', $stream_h ) . '</li>';
- $output .= '<li>' . preg_replace( '/ipad/i', '3000', $stream_h ) . '</li>';
- $output .= '<li>' . preg_replace( '/ipad/i', '1600', $stream_h ) . '</li>';
- $output .= '</ul>';
- $output .= '</li>';
- }
- $output .= '</ul>';
- $output .= '</li>';
- }
- $output .= '</ul>';
- echo $output;
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement