看兰州php
看兰州php 求解答@Wheiss根据大佬帖子修改的 好像验证ip之类的<?php
error_reporting(0);
date_default_timezone_set("PRC");
$ts = $_GET['ts']??'';
if ($ts){
$decodedUts = urldecode($ts);
$data = get_curl($decodedUts);
header('Content-Type: video/MP2T');
header("Content-Disposition: inline; filename={$ts}.ts");
} else {
$https = isset($_SERVER['HTTPS'])?'https':'http';//当前请求的主机使用的协议。
$http_host = $_SERVER['HTTP_HOST'];//当前请求的主机名。
$requestUri = $_SERVER['REQUEST_URI'];//获取当前请求的 URI
$decodedUri = urldecode($requestUri);//URL解码
$Uripath = explode('?',$decodedUri);//strstr($decodedUri,'?',true);
$urlp = "{$https}://{$http_host}{$Uripath}?ts=";
$url = 'http://liveplus.lzr.com.cn/wlpd/HD/live.m3u8';
$m3u8 = get_curl($url);
$urlpath = dirname($url).'/';
$m3u8s = explode("\n",trim($m3u8));
$data = '';
foreach($m3u8s as $m3u8l){
if (stripos($m3u8l,'.ts')!==false){
$data .= $urlp.urlencode($urlpath.$m3u8l).PHP_EOL;
} else {
$data .= $m3u8l.PHP_EOL;
}
}
header("Content-Type: application/vnd.apple.mpegurl");
header("Content-Disposition: inline; filename=index.m3u8");
}
echo $data;
exit;
function get_curl($url){
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_REFERER, 'https://lanzhoubcnew.zainanjing365.com/share/live/detailTv?resourceId=14&appscheme=gdmm-ailanzhou');
$data = curl_exec($ch);
curl_close($ch);
return $data;
}
?>
本帖最后由 Wheiss 于 2025-2-12 18:57 编辑
加个浏览器UA如
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0');
https://iptv.cc/thread-5030-1-1.html
通用的没必要单独写源码
请问播放列表是多少啊?
页:
[1]