ZhuJinFeng

Get link FPT Play [Ver 2.1]

Nov 13th, 2015
760
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.94 KB | None | 0 0
  1. <?php
  2.  
  3. ### Tác giả: Jkey C Phong
  4. ### Vui lòng giữ lại header này khi re-up lên các site khác!
  5.  
  6. Class FPTPlay
  7. {
  8.     Private $__Link = 'http://fptplay.net/show/getlink';
  9.  
  10.     Private Static Function __Curl($Url, $PostData)
  11.     {
  12.         $ch = curl_init();
  13.         curl_setopt($ch, CURLOPT_URL, $Url);
  14.         $Headers   = array();
  15.         $Headers[] = 'Host: fptplay.net';
  16.         $Headers[] = 'User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0';
  17.         $Headers[] = 'Accept: application/json, text/javascript, */*; q=0.01';
  18.         $Headers[] = 'Accept-Language: vi-VN,vi;q=0.8,en-US;q=0.5,en;q=0.3';
  19.         $Headers[] = 'Accept-Encoding: gzip, deflate';
  20.         $Headers[] = 'DNT: 1';
  21.         $Headers[] = 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8';
  22.         $Headers[] = 'X-Requested-With: XMLHttpRequest';
  23.         $Headers[] = 'Referer: ' . $Url;
  24.         $Headers[] = 'Conten-Length: ' . strlen($PostData);
  25.         $Headers[] = 'Connection: keep-alive';
  26.         $Headers[] = 'Pragma: no-cache';
  27.         $Headers[] = 'Cache-Control: no-cache';
  28.         curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');
  29.         curl_setopt($ch, CURLOPT_HTTPHEADER, $Headers);
  30.         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  31.         curl_setopt($ch, CURLOPT_POST, 1);
  32.         curl_setopt($ch, CURLOPT_POSTFIELDS, $PostData);
  33.         curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
  34.         curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
  35.         curl_setopt($ch, CURLOPT_TIMEOUT, 400);
  36.         curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
  37.         $Data = curl_exec($ch);
  38.         if (!$Data) {
  39.             die('Error: "' . curl_error($ch) . '" - Code: ' . curl_errno($ch));
  40.         }
  41.         $HttpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
  42.         curl_close($ch);
  43.         return ($HttpCode >= 200 && $HttpCode < 300) ? $Data : False;
  44.     }
  45.  
  46.     Public Function __GetLink($Url)
  47.     {
  48.         preg_match('#http://fptplay.net/xem-video/(.*?)-([a-z0-9]+).html(.*)#', $Url, $Match);
  49.         $Episode = (!empty($Match[3])) ? explode('-',$Match[3])[1] : 1;
  50.         $Source = FPTPlay::__Curl($this->__Link, 'id=' . $Match[2] . '&type=newchannel&quality=3&episode=' . $Episode . '&mobile=web');
  51.                     if ($Source == False) {
  52.                         exit('Lỗi trong quá trình get source');
  53.                     }
  54.                     $Js = json_decode($Source, 1);
  55.         $Player = "
  56.         <script src='http://www.yan.vn/scripts/jwplayer.js' type='text/javascript'></script>
  57.         <script type='text/javascript'>jwplayer.key = 'FtQ+ubCVmOF2aj8ALHMi/lGfO4o7Oy7xpKmePA==';</script>
  58.         <div id='flashplayer'>Loading...</div>
  59.         <script type='text/javascript'>
  60.             var playerInstance = jwplayer('flashplayer');
  61.             playerInstance.setup({
  62.                 aspectratio: '16:9',
  63.                 controls: true,
  64.                 displaydescription: false,
  65.                 displaytitle: false,
  66.                 mute: false,
  67.                 plugins: {
  68.                     'http://assets-jpcust.jwpsrv.com/player/6/6124956/ping.js': {'pixel': 'http://content.jwplatform.com/ping.gif'}
  69.                 },
  70.                 primary: 'flash',
  71.                 repeat: true,
  72.                 stagevideo: true,
  73.                 stretching: 'uniform',
  74.                 visualplaylist: true,
  75.                 androidhls: true,
  76.                 width: 1E3,
  77.                 height: 556,
  78.                 ph: 1,
  79.                 flashplayer: 'http://static.thanhnien.com.vn/Jscripts/jwplayerads/jwplayer.flash.swf',
  80.                 playlist: [{
  81.                     sources: [{
  82.                     file: '" .$Js['stream']. "',
  83.                     type: 'video/m3u8'
  84.                     }]
  85.                 }]
  86.             });
  87.         </script>";
  88.     return $Player;
  89.     }
  90. }
  91. ?>
  92. <!DOCTYPE html>
  93. <html>
  94. <head>
  95.     <meta charset="utf-8">
  96.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  97.     <title>Jwplayer</title>
  98. </head>
  99.  
  100. <body>
  101.     <style type='text/css'>
  102.         body {
  103.             font-family: Arial, sans-serif;
  104.             background: #777;
  105.         }
  106.         .info {
  107.             background-color: #eee;
  108.             border: thin solid #333;
  109.             border-radius: 3px;
  110.             padding: 0 5px;
  111.             text-align: center;
  112.         }
  113.         #flashplayer_wrapper {
  114.             margin: 40px auto;
  115.         }
  116.     </style>
  117.     <?php
  118.  
  119.     /* Example Get Link FPT Play */
  120.     $Object = New FPTPlay();
  121.     $Source = $Object->__GetLink('http://fptplay.net/xem-video/sep-lon-va-toi-sam-sam-den-roi-thuyet-minh-boss-and-me-55e7b1d917dc13129ea53abc.html');
  122.     Echo $Source;
  123.     /* Example Get Link FPT Play */
  124.    
  125.     ?>
  126. </body>
  127. </html>
Advertisement
Add Comment
Please, Sign In to add comment