'https://iamshajon.com/playlist/bangla.m3u', 'sports' => 'https://iamshajon.com/playlist/sports.m3u', 'fifa' => 'https://iamshajon.com/playlist/fifa.m3u', 'channels' => 'https://iamshajon.com/playlist/channels.m3u' ]; $json_playlists = [ 'bangla' => 'https://iamshajon.com/playlist/bangla.json', 'sports' => 'https://iamshajon.com/playlist/sports.json', 'fifa' => 'https://iamshajon.com/playlist/fifa.json', 'channels' => 'https://iamshajon.com/playlist/channels.json' ]; // ডিফল্ট সেটিংস $current_format = isset($_GET['format']) && $_GET['format'] === 'json' ? 'json' : 'm3u'; $current_tab = isset($_GET['tab']) && array_key_exists($_GET['tab'], $m3u_playlists) ? $_GET['tab'] : 'bangla'; $active_url = ($current_format === 'json') ? $json_playlists[$current_tab] : $m3u_playlists[$current_tab]; // ২. cURL ফাংশন function fetch_playlist_data($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_TIMEOUT, 10); $data = curl_exec($ch); curl_close($ch); return $data; } $raw_data = fetch_playlist_data($active_url); $all_channels = []; // ৩. ফরম্যাট অনুযায়ী ডাটা প্রসেসিং if ($current_format === 'json') { $json_decoded = json_decode($raw_data, true); if (is_array($json_decoded)) { $target_list = isset($json_decoded['channels']) ? $json_decoded['channels'] : $json_decoded; foreach ($target_list as $item) { $all_channels[] = [ 'name' => isset($item['name']) ? $item['name'] : 'Live Channel', 'url' => isset($item['url']) ? $item['url'] : (isset($item['link']) ? $item['link'] : ''), 'logo' => isset($item['logo']) ? $item['logo'] : (isset($item['image']) ? $item['image'] : ''), 'group' => isset($item['group']) ? $item['group'] : (isset($item['category']) ? $item['category'] : 'JSON Stream') ]; } } } else { if ($raw_data) { $lines = explode("\n", $raw_data); $current_channel = null; foreach ($lines as $line) { $line = trim($line); if (strpos($line, '#EXTINF:') === 0) { $current_channel = []; if (preg_match('/,(.*)$/', $line, $name_match)) { $current_channel['name'] = trim($name_match[1]); } else { $current_channel['name'] = "Live Channel"; } if (preg_match('/tvg-logo="([^"]+)"/', $line, $logo_match)) { $current_channel['logo'] = $logo_match[1]; } else { $current_channel['logo'] = ''; } if (preg_match('/group-title="([^"]+)"/', $line, $group_match)) { $current_channel['group'] = $group_match[1]; } else { $current_channel['group'] = "M3U Stream"; } } elseif (!empty($line) && strpos($line, '#') !== 0 && $current_channel) { $current_channel['url'] = $line; $all_channels[] = $current_channel; $current_channel = null; } } } } ?>
Cyber Ultra-Premium Glass UI
Engine Mode: Secure Cyber Dark Glass System