-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathplaylist.php
24 lines (24 loc) · 1.04 KB
/
playlist.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
//=============================================================================//
// SCRIPT WRITTEN BY @YGX_WORLD TEAM, FOR EDUCATION PURPOSE ONLY.
// Don't Sell this Script, This is 100% Free.
//=============================================================================//
$jsonFile = 'data.json';
$jsonData = file_get_contents($jsonFile);
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$host = $_SERVER['HTTP_HOST'];
$requestUri = $_SERVER['REQUEST_URI'];
$scriptUrl = $protocol . $host . str_replace('playlist.php','index.php', $requestUri);
$data = json_decode($jsonData, true);
echo "#EXTM3U\n\n";
foreach ($data['data'] as $channel) {
$id = $channel['id'];
$name = $channel['channel_name'];
$logo = $channel['logo'];
$genre = $channel['genre'];
$streamUrl = $scriptUrl.'?id='. $id;
echo "#EXTINF:-1 tvg-id=\"$id\" group-title=\"$genre\" tvg-logo=\"$logo\",$name\n";
echo "$streamUrl\n\n";
}
exit;
//@yuvraj824