Hello Sir.
Let me write code ;
<?php
// Get the M3U8 URL from the query string
$m3u8_url = $_GET['url'];
// Set the response headers to allow CORS
header("Access-Control-Allow-Origin: *");
header("Content-Type: application/x-mpegURL");
// Create a cURL session
$ch = curl_init();
// Set the cURL options
curl_setopt($ch, CURLOPT_URL, $m3u8_url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Execute the cURL session
$response = curl_exec($ch);
// Check for errors
if ($response === false) {
// Handle the error (e.g., return an error message)
echo "Error fetching M3U8 file: " . curl_error($ch);
} else {
// Output the M3U8 file
echo $response;
}
// Close the cURL session
curl_close($ch);
?>