Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $link = mysql_connect("localhost", "root", "")
- or die("Could not connect");
- $db = mysql_select_db("streams",$link)
- or die("Could not select database");
- error_reporting(0);
- function api($channel)
- {
- $json_file = @file_get_contents("http://api.justin.tv/api/stream/list.json?channel={$channel}", 0, null, null);
- $json_array = json_decode($json_file, true);
- if ($json_array[0]['name'] == "live_user_{$channel}")
- {
- $channelTitle = $json_array[0]['channel']['title'];
- $title = $json_array[0]['channel']['status'];
- $game = $json_array[0]['meta_game'];
- $img = $json_array[0]['channel']['screen_cap_url_medium'];
- $name = $json_array[0]['name'];
- $name2 = "live_user_{$channel}";
- $view ="stream_count_{$channel}";
- $viewers = ($json_array[0]['channel_count']);
- if($game == 'League of Legends')
- echo '
- <style>
- summary::-webkit-details-marker {
- display: none ;
- }
- </style>
- <tr>
- <td><img alt="stream pl league of legends" src="'.$img.'"></td>
- <td>'.$channelTitle.'</td>
- <td>'.$game.'</td>
- <td>'.$viewers.'</td>
- <td>
- <details>
- <summary><a class="btn btn-danger ">Oglądaj »</a></summary>
- <object width="100%" height="300px" bgcolor="#000000" data="http://www.twitch.tv/widgets/live_embed_player.swf?channel='.$channelTitle.'" id="live_embed_player_flash" type="application/x-shockwave-flash"><param value="true" name="allowFullScreen"><param value="always" name="allowScriptAccess"><param value="all" name="allowNetworking"><param value="http://www.twitch.tv/widgets/live_embed_player.swf" name="movie"><param value="hostname=www.twitch.tv&channel='.$channelTitle.'&auto_play=true&start_volume=25" name="flashvars"></object>
- </details>
- </td>
- </tr>
- '
- ;
- return array($channelTitle, $title, $game, $img, $name, $name2);
- }
- else echo '';
- }
- $zpt = 'SELECT nazwa FROM stream';
- $wynik = mysql_query($zpt);
- While ($wys = mysql_fetch_assoc($wynik))
- {
- $zm = $wys['nazwa'];
- $tabl = array($zm);
- $gracze = $zm;
- $kanaly = array('"'.$gracze.'"');
- //tak ma wygladac -> "robertxlee","therainman","phantoml0rd","athenelive","tsm_theoddone","Bischulol","dandinh","guardsmanbob","tsm_dyrus","nyjacky","vman7","salce","voyboy","cadburry"
- $ile = count($kanaly);
- }
- foreach ($kanaly as $co)
- {
- $info = api($co);
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment