分享

战旗直播全站采集php分享(cmp4用)

 黄三岁大爱人生 2018-06-04
php代码在下面:
  1. <?php
  2. $url = $_SERVER["HTTP_REFERER"];
  3. $xml .= "<list>\n";
  4. function t_v($url) {
  5.        $user_agent = $_SERVER['HTTP_USER_AGENT'];
  6.        $ch = curl_init();
  7.        $timeout = 30;
  8.        curl_setopt($ch, CURLOPT_URL, $url);
  9.        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  10.        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
  11.        @ $file = curl_exec($ch);
  12.        curl_close($ch);
  13.        return $file;
  14. }
  15. $fname = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER["SCRIPT_NAME"];
  16. if (isset($_GET['id'])) {
  17. $strt = @file_get_contents('http://www.' . $_GET['id'] . '');
  18. preg_match('#window.gameId = (.*?);#',$strt,$vid);
  19.        $a = 'http://www./api/static/game.lives/'.$vid[1].'/1000-1.json';
  20.                   $b = @file_get_contents($a);
  21.            $json = json_decode($b,true);
  22.                 $zonghe = $json['data']['rooms'];
  23.        $f = count($zonghe);
  24.        for($m=0;$m<$f;$m++){
  25.         $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;
  26.     }
  27. }
  28. else {
  29.     $a = 'http://www./games';
  30.     $v = file_get_contents($a);
  31.     preg_match_all('/<img src="([^"]+)" alt="([^"]+)">/imsU', $v, $str);
  32.     preg_match_all('/<a href="([^"]+)">/imsU', $v, $str1);
  33.     preg_match_all('/<p class="name">([^"]+)<\/p>/imsU', $v, $mz);
  34.     foreach ($str[1] as $k => $v) {
  35.         $xml.= '<m list_src="' . $fname . '?id=' . $str1[1][$k] . '" image="' . $str[1][$k] . '" label="' . $mz[1][$k] . '"/>' . PHP_EOL;
  36.     }
  37. }
  38. $xml.= "</list>";
  39. echo $xml;
  40. ?>
复制代码

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多