Advertisement
Guest User

javhd

a guest
Jun 13th, 2018
700
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.41 KB | None | 0 0
  1. <?php
  2. function Cget($url,$ref=0) {
  3.     $headers = Array(
  4.     'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg',
  5.     'Connection: Keep-Alive',
  6.     'Accept: */*',
  7.     'Content-Type: application/x-www-form-urlencoded; charset=utf-8'
  8.     );
  9.     $process = curl_init($url);
  10.     curl_setopt($process, CURLOPT_HTTPHEADER, $headers);
  11.     curl_setopt($process, CURLOPT_HEADER, 0);
  12.     if($ref)
  13.     {
  14.         curl_setopt($process, CURLOPT_REFERER, $ref);
  15.     }
  16.     curl_setopt($process, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36');
  17.     curl_setopt($process, CURLOPT_COOKIEFILE, realpath('cookie.txt'));
  18.     curl_setopt($process, CURLOPT_COOKIEJAR, realpath('cookie.txt'));
  19.     curl_setopt($process,CURLOPT_ENCODING , 'gzip');
  20.     curl_setopt($process, CURLOPT_TIMEOUT, 30);
  21.     curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
  22.     curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
  23.     curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
  24.     $return = curl_exec($process);
  25.     curl_close($process);
  26.     return $return;
  27. }
  28. function getLocation($url) {
  29.     $headers = Array(
  30.         'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg',
  31.         'Connection: Keep-Alive',
  32.         'Accept: */*',
  33.         'Content-Type: application/x-www-form-urlencoded; charset=utf-8'
  34.     );
  35.     $ch = curl_init($url);
  36.     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
  37.     curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36');
  38.     curl_setopt($ch, CURLOPT_COOKIEFILE, realpath('cookie.txt'));
  39.     curl_setopt($ch, CURLOPT_COOKIEJAR, realpath('cookie.txt'));
  40.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
  41.     curl_setopt($ch, CURLOPT_HEADER, TRUE);
  42.     curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
  43.     $response = curl_exec($ch);
  44.     preg_match_all('/^Location:(.*)$/mi', $response, $matches);
  45.     curl_close($ch);
  46.     return trim($matches[1][0]);
  47. }
  48. function Cpost($url,$data, $ref=0) {
  49.     $headers = Array(
  50.     'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg',
  51.     'Connection: Keep-Alive',
  52.     'Accept: */*',
  53.     'Content-Type: application/x-www-form-urlencoded; charset=utf-8'
  54.     );
  55.     $process = curl_init($url);
  56.     curl_setopt($process, CURLOPT_URL, $url);
  57.     curl_setopt($process, CURLOPT_HEADER, 1);
  58.     //curl_setopt($process, CURLOPT_COOKIESESSION, false);
  59.     curl_setopt($process, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.75 Safari/537.36');
  60.     curl_setopt($process, CURLOPT_COOKIEFILE, realpath('cookie.txt'));
  61.     curl_setopt($process, CURLOPT_COOKIEJAR, realpath('cookie.txt'));
  62.     curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
  63.     if($ref)
  64.     {
  65.         curl_setopt($process, CURLOPT_REFERER, $ref);
  66.     }
  67.     curl_setopt($process,CURLOPT_ENCODING , 'gzip');
  68.     curl_setopt($process, CURLOPT_POSTFIELDS, $data);
  69.     curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
  70.     curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
  71.     curl_setopt($process, CURLOPT_POST, 1);
  72.     $return = curl_exec($process);
  73.     curl_close($process);
  74.     return $return;
  75. }
  76. function explode_by($begin,$end,$data) {
  77.     $data = explode($begin,$data);
  78.     $data = explode($end,$data[1]);
  79.     return $data[0];
  80. }
  81. function getplayer($html,$thumb) {
  82.     $player = "<script type=\"text/javascript\" src=\"/jw.js\"></script>
  83. <script>jwplayer.key = \"MBvrieqNdmVL4jV0x6LPJ0wKB/Nbz2Qq/lqm3g==\";</script>";
  84.     $player .= '<div id="VHSPlugins"></div>
  85.        <script type="text/javascript">
  86.        jwplayer("VHSPlugins").setup({
  87.            sources: '.$html.',
  88.            width: "100%",
  89.            height: "100%",
  90.            controls: true,
  91.            autostart: false,
  92.            image: "'.$thumb.'",
  93.            allowfullscreen: true,
  94.            preload: "auto",
  95.            skin: {
  96.                name: "seven"
  97.            }
  98.        });
  99.    </script>';
  100. echo $player;
  101. }
  102. //cache
  103. function cache($url,$expire){
  104.     $urlnew = str_replace(array(".","://","/"),array("_","_","_"),$url);
  105.     $dir = 'cache/';
  106.     $file = 'cache/'.$urlnew.'.txt';
  107.     if (!is_dir($dir)) {
  108.         mkdir($dir, 0777);
  109.     }
  110.     if(file_exists($file) && filemtime($file) > (time() - $expire))
  111.     {
  112.         $dataplay = file_get_contents($file);
  113.     }
  114.     else
  115.     {
  116.         $location = getLocation($url);
  117.         savecache($urlnew,$location);
  118.         $dataplay = $location;
  119.     }
  120.     return $dataplay;
  121. }
  122. function savecache($name,$dataplay)
  123. {  
  124.     $file = 'cache/'.$name.'.txt';
  125.     $fp = fopen($file, "w");
  126.     fputs($fp, $dataplay);
  127.     fclose($fp);
  128. }
  129. $user = "username";
  130. $pass = "password";
  131. $data = "login=$user&password=$pass&back=javhd.com&path=L2Vu";
  132. if(file_exists("cookie.txt") == 1) {
  133.     Cpost("https://secure.javhd.com/login/",$data);
  134. }
  135. //
  136. $url = $_GET["url"];
  137. preg_match('#https://javhd.com/en/id/(.*?)/#',$url,$matchurl);
  138. $id = $matchurl[1];
  139. $html = Cget("https://javhd.com/en/player/$id?type=vjs","https://secure.javhd.com/login/");
  140. $arr = json_decode($html,true);
  141. $image = $arr["poster"];
  142. for($i=0;$i<count($arr["sources"]);$i++) {
  143.     $jw[$i]["file"] = getLocation($arr["sources"][$i]["src"]);
  144.     $jw[$i]["label"] = $arr["sources"][$i]["label"];
  145.     $jw[$i]["type"] = $arr["sources"][$i]["type"];
  146. }
  147. echo getplayer(json_encode($jw),$image);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement