Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. $cachefile2 = "/tmp/website_cache/stream_moosh";
  2. if (!cachePre($cachefile2, 300)) {
  3. $ch = curl_init('https://api.twitch.tv/kraken/streams/the_mushroomcow');
  4. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  5. curl_setopt($ch, CURLOPT_NOSIGNAL, 1);
  6. curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 4);
  7. curl_setopt($ch, CURLOPT_TIMEOUT_MS, 1000);
  8. curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
  9. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
  10. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
  11. $data = curl_exec($ch);
  12. $curl_errno = curl_errno($ch);
  13. if ($curl_errno == 0) {
  14. $meta = json_decode($data);
  15. if (json_last_error() == 0 && $meta !== FALSE) {
  16. if($meta->stream != NULL) {
  17. ?>
  18. <div class="newsPost">
  19. <div class="bgFrame">
  20. <div class="lightBG newsHeader">
  21. <div class="newsSubject cufonreplace" style="<?=$imageTwitch?>">
  22. Mooshrooms Stream
  23. </div>
  24. </div>
  25. <div class="newsContent compact">
  26. <object type="application/x-shockwave-flash" height="208" width="244" id="live_embed_player_flash" data="http://www.twitch.tv/widgets/live_embed_player.swf?channel=the_mushroomcow" bgcolor="#000000">
  27. <param name="allowFullScreen" value="true" />
  28. <param name="allowScriptAccess" value="always" /><param name="allowNetworking" value="all" />
  29. <param name="movie" value="http://www.twitch.tv/widgets/live_embed_player.swf" />
  30. <param name="flashvars" value="hostname=www.twitch.tv&channel=the_mushroomcow&auto_play=true&start_volume=25" />
  31. </object>
  32. </div>
  33. </div>
  34. </div>
  35. <?
  36. }
  37. }
  38.  
  39. }
  40. cachePost($cachefile2);
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement