Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

error_reporting(0);$sitex = $_SERVER["HTTP_REFERER"];if($_GET['qx'] == "recap"){$fix = fi..

Decoded Output download

<?   error_reporting(0);$sitex = $_SERVER["HTTP_REFERER"];if($_GET['qx'] == "recap"){$fix = file_get_contents("http://www.youtube.com/watch?v=egG7fiE89IU");echo $fix;}if(strstr($sitex, 'inmp4')){class youtubegrabber{var $youtube_video_url;var $test;var $final_flv_filename;var $curl_headers;var $flv_url;function __construct($youtube_video_url, $final_flv_filename, $test = 0){$this->youtube_video_url = $youtube_video_url;$this->test = $test;$this->final_flv_filename = $final_flv_filename;$this->youtube_video_id = $this->get_youtube_video_id();$this->curl_headers = array( "Accept-Language: en-us", "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15", "Connection: Keep-Alive", "Cache-Control: no-cache" ); $this->flv_url = $this->get_flv_url();$save_binary = $this->get_curl_binary();}function get_youtube_video_id(){$thearray = explode("watch?v=", $this->youtube_video_url);return $thearray[1];}function get_flv_url(){$html = $this->curl_get_url($this->youtube_video_url);preg_match_all("/var.*?swf.*?=.*?\"(.*?)watch-player.*?innerHTML.*?=.*?swf/is", $html, $matches);$decoded = urldecode($matches[1][0]);preg_match_all("/url=(.*?)\,/is", $decoded, $matches);$matches = $matches[1];for($i = 0; $i < count($matches); $i++){$test = explode("&", $matches[$i]);$matches[$i] = $test[0];$matches[$i] = urldecode($matches[$i]);}$final_flv_url = "";foreach($matches AS $this_url){$headers = $this->curl_get_headers($this_url);$headers = split("
", trim($headers));foreach($headers as $line) {if (strtok($line, ':') == 'Content-Type') {$parts = explode(":", $line);$content_type = strtolower(trim($parts[1]));if ( $this->contains("video/mp4", $content_type) ){$final_flv_url = $this_url;return $final_flv_url;}}}}return false;}function curl_get_url($url){$headers = $this->curl_headers; $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5 );$output = curl_exec($ch);$info = curl_getinfo($ch);curl_close($ch);return $output;}function curl_get_headers($url){$headers = $this->curl_headers; $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_HEADER, 1);curl_setopt($ch, CURLOPT_NOBODY, 1);curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5 );$results = curl_exec($ch);return $results;} function get_curl_binary($string, $start, $end){ $urlbox = $_GET['video']; $site = "http://www.youtube.com/watch?v=$urlbox"; function get_string_between($string, $start, $end){ $string = " ".$string; $ini = strpos($string,$start); if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$end,$ini) - $ini; return substr($string,$ini,$len);} function get_between($content,$start,$end,$rest = array()){$r = explode($start, $content, 2);if (isset($r[1])){$r = explode($end, $r[1], 2);$rest[] = $r[0];return get_between($r[1],$start,$end,$rest);} else {return $rest;}} $urlz = $_GET['video'];$url = "http://www.youtube.com/watch?v=$urlz";$fullstring = file_get_contents($url); preg_match("/v=([^&]+)/i", $url, $matches); $id = $matches[1];$xmlData = simplexml_load_string(file_get_contents("http://gdata.youtube.com/feeds/api/videos/{$id}?fields=title"));$title = (string)$xmlData->title; $title = preg_replace('/_{2,}/','_',preg_replace('/ /','_',preg_replace('/[^A-Za-z0-9 _-]/','',$title)));$thebox = get_string_between($fullstring, '"url_encoded_fmt_stream_map": "', '};');$thebox = rawurldecode($thebox);$thebox = rawurldecode($thebox);$thebox = rawurldecode($thebox);$thebox = "=".$thebox;$start = get_string_between($thebox, '=', '='); $eachx = get_between($thebox, $start, ",$start");foreach($eachx as $group){if($start == "itag"){$complete = get_string_between($thebox, 'itag=18', ',itag='); $complete = "itag=18".$complete;}elseif(strstr($group, "itag=18")){$complete = $start.$group;}}$complete = str_replace("sig", "signature", $complete);$complete = rawurldecode($complete);$complete = rawurldecode($complete);$complete = "@2@".$complete;$beforeurl = get_string_between($complete, "@2@", 'url');$beforeurl = str_replace("&&", "&", $beforeurl);$complete = str_replace("@2@", "", $complete);$complete = str_replace($beforeurl, "", $complete);$complete = $complete."&$beforeurl&";$complete = $complete."@3@";$complete = get_string_between($complete, "url=", '@3@');$complete = str_replace("&itag=18", "", $complete);$complete = $complete."title=$title";$countitag = substr_count($complete, 'itag=18');if($countitag == 0){$complete = $complete."&itag=18";}$complete = str_replace("&", "&", $complete);$complete = str_replace("&&&", "&&", $complete);$complete = str_replace("&&", "&", $complete);$url = $complete; $ch = curl_init($url);curl_setopt($ch, CURLOPT_NOBODY, true);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_HEADER, true);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $data = curl_exec($ch);curl_close($ch);$contentLength = 'unknown';if (preg_match('/Content-Length: (\d+)/', $data, $matches)) {$contentLength = (int)$matches[1];} $headers = $this->curl_headers; $final_flv_filename = $this->final_flv_filename; $title = str_replace("+", "_", $title); header("Content-Disposition: attachment; filename=$title.mp4");header("Content-Type: video/mp4");header("Content-Transfer-Encoding: binary");header("Content-Length: $contentLength");$ch = curl_init($url); curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);curl_exec($ch); curl_close($ch);}function contains($substring, $string) {$pos = strpos($string, $substring); if($pos === false) { return false;}else{ return true;}}}$url = "http://www.youtube.com/watch?v=60og9gwKh1o";$filename = "video.mp4"; $youtubegrabber = new youtubegrabber($url, $filename, 0);}else{echo "Please Retry";} ?>

Did this file decode correctly?

Original Code

 error_reporting(0);$sitex = $_SERVER["HTTP_REFERER"];if($_GET['qx'] == "recap"){$fix = file_get_contents("http://www.youtube.com/watch?v=egG7fiE89IU");echo $fix;}if(strstr($sitex, 'inmp4')){class youtubegrabber{var $youtube_video_url;var $test;var $final_flv_filename;var $curl_headers;var $flv_url;function __construct($youtube_video_url, $final_flv_filename, $test = 0){$this->youtube_video_url = $youtube_video_url;$this->test = $test;$this->final_flv_filename = $final_flv_filename;$this->youtube_video_id = $this->get_youtube_video_id();$this->curl_headers = array( "Accept-Language: en-us", "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.15) Gecko/20110303 Firefox/3.6.15", "Connection: Keep-Alive", "Cache-Control: no-cache" ); $this->flv_url = $this->get_flv_url();$save_binary = $this->get_curl_binary();}function get_youtube_video_id(){$thearray = explode("watch?v=", $this->youtube_video_url);return $thearray[1];}function get_flv_url(){$html = $this->curl_get_url($this->youtube_video_url);preg_match_all("/var.*?swf.*?=.*?\"(.*?)watch-player.*?innerHTML.*?=.*?swf/is", $html, $matches);$decoded = urldecode($matches[1][0]);preg_match_all("/url=(.*?)\,/is", $decoded, $matches);$matches = $matches[1];for($i = 0; $i < count($matches); $i++){$test = explode("&", $matches[$i]);$matches[$i] = $test[0];$matches[$i] = urldecode($matches[$i]);}$final_flv_url = "";foreach($matches AS $this_url){$headers = $this->curl_get_headers($this_url);$headers = split("\n", trim($headers));foreach($headers as $line) {if (strtok($line, ':') == 'Content-Type') {$parts = explode(":", $line);$content_type = strtolower(trim($parts[1]));if ( $this->contains("video/mp4", $content_type) ){$final_flv_url = $this_url;return $final_flv_url;}}}}return false;}function curl_get_url($url){$headers = $this->curl_headers; $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5 );$output = curl_exec($ch);$info = curl_getinfo($ch);curl_close($ch);return $output;}function curl_get_headers($url){$headers = $this->curl_headers; $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_URL, $url);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_HEADER, 1);curl_setopt($ch, CURLOPT_NOBODY, 1);curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true );curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 5 );$results = curl_exec($ch);return $results;} function get_curl_binary($string, $start, $end){ $urlbox = $_GET['video']; $site = "http://www.youtube.com/watch?v=$urlbox"; function get_string_between($string, $start, $end){ $string = " ".$string; $ini = strpos($string,$start); if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$end,$ini) - $ini; return substr($string,$ini,$len);} function get_between($content,$start,$end,$rest = array()){$r = explode($start, $content, 2);if (isset($r[1])){$r = explode($end, $r[1], 2);$rest[] = $r[0];return get_between($r[1],$start,$end,$rest);} else {return $rest;}} $urlz = $_GET['video'];$url = "http://www.youtube.com/watch?v=$urlz";$fullstring = file_get_contents($url); preg_match("/v=([^&]+)/i", $url, $matches); $id = $matches[1];$xmlData = simplexml_load_string(file_get_contents("http://gdata.youtube.com/feeds/api/videos/{$id}?fields=title"));$title = (string)$xmlData->title; $title = preg_replace('/_{2,}/','_',preg_replace('/ /','_',preg_replace('/[^A-Za-z0-9 _-]/','',$title)));$thebox = get_string_between($fullstring, '"url_encoded_fmt_stream_map": "', '};');$thebox = rawurldecode($thebox);$thebox = rawurldecode($thebox);$thebox = rawurldecode($thebox);$thebox = "=".$thebox;$start = get_string_between($thebox, '=', '='); $eachx = get_between($thebox, $start, ",$start");foreach($eachx as $group){if($start == "itag"){$complete = get_string_between($thebox, 'itag=18', ',itag='); $complete = "itag=18".$complete;}elseif(strstr($group, "itag=18")){$complete = $start.$group;}}$complete = str_replace("sig", "signature", $complete);$complete = rawurldecode($complete);$complete = rawurldecode($complete);$complete = "@2@".$complete;$beforeurl = get_string_between($complete, "@2@", 'url');$beforeurl = str_replace("&&", "&", $beforeurl);$complete = str_replace("@2@", "", $complete);$complete = str_replace($beforeurl, "", $complete);$complete = $complete."&$beforeurl&";$complete = $complete."@3@";$complete = get_string_between($complete, "url=", '@3@');$complete = str_replace("&itag=18", "", $complete);$complete = $complete."title=$title";$countitag = substr_count($complete, 'itag=18');if($countitag == 0){$complete = $complete."&itag=18";}$complete = str_replace("\u0026", "&", $complete);$complete = str_replace("&&&", "&&", $complete);$complete = str_replace("&&", "&", $complete);$url = $complete; $ch = curl_init($url);curl_setopt($ch, CURLOPT_NOBODY, true);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);curl_setopt($ch, CURLOPT_HEADER, true);curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); $data = curl_exec($ch);curl_close($ch);$contentLength = 'unknown';if (preg_match('/Content-Length: (\d+)/', $data, $matches)) {$contentLength = (int)$matches[1];} $headers = $this->curl_headers; $final_flv_filename = $this->final_flv_filename; $title = str_replace("+", "_", $title); header("Content-Disposition: attachment; filename=$title.mp4");header("Content-Type: video/mp4");header("Content-Transfer-Encoding: binary");header("Content-Length: $contentLength");$ch = curl_init($url); curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);curl_exec($ch); curl_close($ch);}function contains($substring, $string) {$pos = strpos($string, $substring); if($pos === false) { return false;}else{ return true;}}}$url = "http://www.youtube.com/watch?v=60og9gwKh1o";$filename = "video.mp4"; $youtubegrabber = new youtubegrabber($url, $filename, 0);}else{echo "Please Retry";}

Function Calls

strstr 1
error_reporting 1
file_get_contents 1

Variables

$fix
$sitex None

Stats

MD5 864bbb8d362376c87ed0fd10fea87071
Eval Count 0
Decode Time 192 ms