Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function Cget($url,$ref=0) {
- $headers = Array(
- 'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg',
- 'Connection: Keep-Alive',
- 'Accept: */*',
- 'Content-Type: application/x-www-form-urlencoded; charset=utf-8'
- );
- $process = curl_init($url);
- curl_setopt($process, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($process, CURLOPT_HEADER, 0);
- if($ref)
- {
- curl_setopt($process, CURLOPT_REFERER, $ref);
- }
- 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');
- curl_setopt($process, CURLOPT_COOKIEFILE, realpath('cookie.txt'));
- curl_setopt($process, CURLOPT_COOKIEJAR, realpath('cookie.txt'));
- curl_setopt($process,CURLOPT_ENCODING , 'gzip');
- curl_setopt($process, CURLOPT_TIMEOUT, 30);
- curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
- curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
- $return = curl_exec($process);
- curl_close($process);
- return $return;
- }
- function getLocation($url) {
- $headers = Array(
- 'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg',
- 'Connection: Keep-Alive',
- 'Accept: */*',
- 'Content-Type: application/x-www-form-urlencoded; charset=utf-8'
- );
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- 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');
- curl_setopt($ch, CURLOPT_COOKIEFILE, realpath('cookie.txt'));
- curl_setopt($ch, CURLOPT_COOKIEJAR, realpath('cookie.txt'));
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
- curl_setopt($ch, CURLOPT_HEADER, TRUE);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, FALSE);
- $response = curl_exec($ch);
- preg_match_all('/^Location:(.*)$/mi', $response, $matches);
- curl_close($ch);
- return trim($matches[1][0]);
- }
- function Cpost($url,$data, $ref=0) {
- $headers = Array(
- 'Accept: image/gif, image/x-bitmap, image/jpeg, image/pjpeg',
- 'Connection: Keep-Alive',
- 'Accept: */*',
- 'Content-Type: application/x-www-form-urlencoded; charset=utf-8'
- );
- $process = curl_init($url);
- curl_setopt($process, CURLOPT_URL, $url);
- curl_setopt($process, CURLOPT_HEADER, 1);
- //curl_setopt($process, CURLOPT_COOKIESESSION, false);
- 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');
- curl_setopt($process, CURLOPT_COOKIEFILE, realpath('cookie.txt'));
- curl_setopt($process, CURLOPT_COOKIEJAR, realpath('cookie.txt'));
- curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false);
- if($ref)
- {
- curl_setopt($process, CURLOPT_REFERER, $ref);
- }
- curl_setopt($process,CURLOPT_ENCODING , 'gzip');
- curl_setopt($process, CURLOPT_POSTFIELDS, $data);
- curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($process, CURLOPT_FOLLOWLOCATION, 1);
- curl_setopt($process, CURLOPT_POST, 1);
- $return = curl_exec($process);
- curl_close($process);
- return $return;
- }
- function explode_by($begin,$end,$data) {
- $data = explode($begin,$data);
- $data = explode($end,$data[1]);
- return $data[0];
- }
- function getplayer($html,$thumb) {
- $player = "<script type=\"text/javascript\" src=\"/jwplayer-7.12.3/jwplayer.js\"></script>
- <script>jwplayer.key = \"kVtDqPqOwahhlnOKSiNDPFJLsul6G4JQkmVdYO7jcPo=\";</script>";
- $player .= '<div id="VHSPlugins"></div>
- <script type="text/javascript">
- jwplayer("VHSPlugins").setup({
- sources: '.$html.',
- width: "100%",
- height: "100%",
- controls: true,
- autostart: false,
- image: "'.$thumb.'",
- allowfullscreen: true,
- preload: "auto",
- skin: {
- name: "seven"
- }
- });
- </script>';
- echo $player;
- }
- //cache
- function cache($url,$expire){
- $urlnew = str_replace(array(".","://","/"),array("_","_","_"),$url);
- $dir = 'cache/';
- $file = 'cache/'.$urlnew.'.txt';
- if (!is_dir($dir)) {
- mkdir($dir, 0777);
- }
- if(file_exists($file) && filemtime($file) > (time() - $expire))
- {
- $dataplay = file_get_contents($file);
- }
- else
- {
- $location = getLocation($url);
- savecache($urlnew,$location);
- $dataplay = $location;
- }
- return $dataplay;
- }
- function savecache($name,$dataplay)
- {
- $file = 'cache/'.$name.'.txt';
- $fp = fopen($file, "w");
- fputs($fp, $dataplay);
- fclose($fp);
- }
- $user = "username";
- $pass = "password";
- $data = "login=$user&password=$pass&back=javhd.com&path=L2Vu";
- if(file_exists("cookie.txt") == 1) {
- Cpost("https://secure.javhd.com/login/",$data);
- }
- //
- $url = $_GET["url"];
- preg_match('#https://javhd.com/en/id/(.*?)/#',$url,$matchurl);
- $id = $matchurl[1];
- $html = Cget("https://javhd.com/en/player/$id?type=vjs","https://secure.javhd.com/login/");
- $arr = json_decode($html,true);
- $image = $arr["poster"];
- for($i=0;$i<count($arr["sources"]);$i++) {
- $jw[$i]["file"] = cache($arr["sources"][$i]["src"], 3600);
- $jw[$i]["label"] = $arr["sources"][$i]["label"];
- $jw[$i]["type"] = $arr["sources"][$i]["type"];
- }
- echo getplayer(json_encode($jw),$image);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement