<?php

//header("Content-Type: application/vnd.apple.mpegurl");
$list = json_decode(file_get_contents('smart4k.json'));
$host = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http")."://".$_SERVER['HTTP_HOST'];
$JSON = $list->js->data;


echo '#EXTM3U url-tvg=""'.  "\n\n";
foreach($JSON as $channel){
      echo '#EXTINF:1 tvg-id="'.$channel->id.'" group-title="smart4k" tvg-name="'.$channel->name.'" tvg-logo="'.$host.'/'.$channel->logo.'",'.$channel->name."\n"
    .$host.'/smart4k/play.php?tv='.$channel->cmds[0]->ch_id."\n\n";
	 }
      
?>