php代码在下面:
- <?php
- $url = $_SERVER["HTTP_REFERER"];
- $xml .= "<list>\n";
- function t_v($url) {
- $user_agent = $_SERVER['HTTP_USER_AGENT'];
- $ch = curl_init();
- $timeout = 30;
- curl_setopt($ch, CURLOPT_URL, $url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
- @ $file = curl_exec($ch);
- curl_close($ch);
- return $file;
- }
- $fname = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER["SCRIPT_NAME"];
- if (isset($_GET['id'])) {
- $strt = @file_get_contents('http://www.' . $_GET['id'] . '');
- preg_match('#window.gameId = (.*?);#',$strt,$vid);
- $a = 'http://www./api/static/game.lives/'.$vid[1].'/1000-1.json';
- $b = @file_get_contents($a);
- $json = json_decode($b,true);
- $zonghe = $json['data']['rooms'];
- $f = count($zonghe);
- for($m=0;$m<$f;$m++){
- $xml.='<m type="2" src="http://121.14.89.233/yfhdl.cdn./zqlive/' . $zonghe[$m]['videoId'] . '.flv" image="' . $zonghe[$m]['spic'] . '" label="' . $zonghe[$m]['title'] . '" />' . PHP_EOL;
- }
- }
- else {
- $a = 'http://www./games';
- $v = file_get_contents($a);
- preg_match_all('/<img src="([^"]+)" alt="([^"]+)">/imsU', $v, $str);
- preg_match_all('/<a href="([^"]+)">/imsU', $v, $str1);
- preg_match_all('/<p class="name">([^"]+)<\/p>/imsU', $v, $mz);
- foreach ($str[1] as $k => $v) {
- $xml.= '<m list_src="' . $fname . '?id=' . $str1[1][$k] . '" image="' . $str[1][$k] . '" label="' . $mz[1][$k] . '"/>' . PHP_EOL;
- }
- }
- $xml.= "</list>";
- echo $xml;
- ?>
复制代码
|