Hi everyone, I am developing this PHP to be able to view this video. But the source server diverts me with error 403. I am trying to do an IP Spoofing to bypass that with control. Here I leave the PHP for you to play to see if we all look for the way it works. Thank you.
Code:
if (isset($_GET['ts'])) {
header('Content-type: text/plain');
error_reporting(0);
echo curl_get (rtrim($_GET['ts']));
exit();
}
$server2 = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}";
header('Content-type: text/plain');
//$cat = $_GET['cat'];
//$ch = $_GET['ch'];
$cat='espana';
$ch='antena3';
$baseurl="https://adictosalatele.com/TV/".$cat."/".$ch."/";
$comp_ip = parse_url($baseurl);
# print_r($comp_ip);exit();
$ip=gethostbyname($comp_ip['host']);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$baseurl);
curl_setopt($ch, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:68.0) Gecko/20100101 Firefox/68.0');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$rs = curl_exec($ch);
preg_match('@(http.+?embed.+?)"@', $rs, $link);
$id=$link[1];
$id= trim($id);
$ch2 = curl_init();
curl_setopt($ch2, CURLOPT_URL, $id);
curl_setopt($ch2, CURLOPT_HTTPHEADER, array("REMOTE_ADDR: $ip", "HTTP_X_FORWARDED_FOR: $ip"));
curl_setopt($ch2, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch2, CURLOPT_USERAGENT,'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36 Edg/83.0.478.45');
curl_setopt($ch2, CURLOPT_REFERER, $baseurl);
$html = curl_exec($ch2);
$bodytag = str_replace("window==window.top", "", $html);
$regex2='parentId\|(.+?)\|(.+?)\|startMuted';
preg_match("/".$regex2."/is", $bodytag, $param);
$token = $param[2];
$timestamp = $param[1];
preg_match('@embed/(.+)@',$id,$match);
$url="https://ul.cdn946.net:8443/hls/".$match[1].".m3u8?s=".$token."&e=".$timestamp;
$comp_ip_2 = parse_url($id);
$ip_2=gethostbyname($comp_ip_2['host']);
$userAgent = 'Chrome';
$header[] = 'Connection: keep-alive';
$header[] = 'User-Agent:'.$userAgent;
$header[] = 'Accept: */*';
$header[] = 'Origin:'.$comp_ip_2['host'];
$header[] = 'Sec-Fetch-Site: cross-site';
$header[] = 'Sec-Fetch-Mode: cors';
$header[] = 'Sec-Fetch-Dest: empty';
$header[] = 'Referer:'.$embedurl;
$header[] = "Remote_Addr:".$ip;
$header[] = "Http_X_Forwarded_For:".$ip;
$header[] = 'Accept-Language: en-US,en;q=0.9,es;q=0.8';
$header[] = 'If-None-Match: "5efa96e8-3a9"';
$header[] = 'If-Modified-Since:'.date(DATE_RFC822);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERAGENT, $userAgent);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$contenido = curl_exec($ch);
curl_close($ch);
print_r ($contenido);