Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function getWebPage(){
- $url = 'https://api.hitbox.tv/media/status/creativescapersps';
- $ch = curl_init();
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_URL,$url);
- $result = curl_exec($ch);
- curl_close($ch);
- $result = json_decode($result, true);
- if($result['media_is_live'] == 1){
- return true;
- //you could display the amount of viewers with $result['media_views'] if you want to
- }else{
- return false;
- }
- }
- if(getWebPage() == false){
- $img = imagecreatefrompng('crsoffline.png');
- }else{
- $img = imagecreatefrompng('crsonline.png');
- }
- header("Content-Type: image/png");
- imagepng($img);
- imagedestroy($img);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement