guoma 发表于 2023-10-13 21:37:57

宜昌台php

本帖最后由 guoma 于 2023-10-14 12:00 编辑

<?php
$id = isset($_GET['id'])?$_GET['id']:'yczh';
$fmt = isset($_GET['fmt'])?$_GET['fmt']:'';//hls,rtm
$n = [
   'yczh' => 1,//宜昌综合
   'yclysh' => 2,//宜昌旅游生活
   ];
if($fmt == ''||$fmt == 'hls'){
$url = "http://www.3xgd.com/live/{$n[$id]}.html";
$d = get($url);
preg_match("|source:'(.*)'|", $d, $p);
$playurl = $p;
header('Content-Type: application/vnd.apple.mpegurl');
header("location:".$playurl);
//echo $playurl;
}

if($fmt == 'rtm'){
$url = "http://www.3xgd.com/getaddr20211214/channelid/{$n[$id]}";
$str = get($url);
preg_match('|liveaddr="(.*)"|', $str, $d);
$baseurl = openssl_decrypt($d, 'aes-128-cbc', 'nmkuferthyuj65r', OPENSSL_ZERO_PADDING, base64_decode('AXSDEHCbdfgfrtVGTGoREH=='));
$playurl = trim(preg_replace("|refer=http://www.3xgd.com/live&|", "",$baseurl));
header("Location:".$playurl);
//echo $playurl;
}

function get($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_USERAGENT, 'Mozilla/5.0');
   curl_setopt($ch, CURLOPT_REFERER, "http://www.3xgd.com/live");
   $data = curl_exec($ch);
   curl_close($ch);
   return $data;
   }
?>

tvzb 发表于 2023-10-13 21:47:02

谢谢分享。{:2_40:}

zgntv 发表于 2023-10-13 23:09:39

dajigan 发表于 2023-10-13 23:28:34

宜昌台php [修改

dajigan 发表于 2023-10-14 07:42:22

宜昌台php [修改]

四维 发表于 2023-10-14 09:08:22

谢谢大佬分享。

奥力给 发表于 2023-10-14 12:00:47

给力!         

sfee 发表于 2023-10-21 15:06:24

海纳百川,有容乃大。壁立千仞,无欲则刚。

easy2003 发表于 2024-2-17 13:55:08

啃瓜子,看好贴。
页: [1]
查看完整版本: 宜昌台php