3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ERROR); $resolution[22]='720_mp4'; $resolution[18]='360_mp4'; $resolution[43]='360_webm'; $resolution[5]='240p_flv'; $resolution[36]='240p_3gp'; $resolution[17]='114p_3gp'; $data = getpage($_GET['url']); //$data = file_get_contents($_GET['url']); preg_match('/ytplayer.config = {(.*?)};/',$data,$match); //debug($match); $o = json_decode('{'.$match[1].'}') ; $links = explode(',',$o -> args -> url_encoded_fmt_stream_map); //print_r ($links); foreach($links as $link) { parse_str($link,$r); //echo $link." - ".$r."<br />"; print_r ($r); //debug($r); /* if ($r['s']) { echo ('<a href="/domain.com/play.php?token='. urlencode($r['url']."&signature=".decrypt_sig($r['s'],'fr_FR-vflmo6Hkk/html5player')).'&fn=video.mp4">quality: '.$resolution[$r['itag']].'</a><br />'); } else { //$linkr = preg_replace("/googlevideo.com/","c.docs.google.com",$r['url']); //$link = preg_replace("/http:/","https:",$linkr); echo '<a href="'.$r['url'].'">quality: '.$resolution[$r['itag']].'</a><br />'; } */ //echo '<div>'.$r['s'].'</div>'; } function decrypt_sig($s,$player_id) { /* Methods / Commands for decrypting sig. - r = reverse the string; - sN = slice from character N to the end; - wN = swap 0th and Nth character. */ $algo = array( 'fr_FR-vflmo6Hkk/html5player' => 'w8 s3 w45 w46 s2 w29 w25 w56 w2', // 26 sep 2014, ); $method = explode(" ",$algo[$player_id]); foreach($method as $m) { if($m == 'r') $s = strrev($s); else if( substr($m,0,1) == 's') $s = substr($s, (int) substr($m,1) ); else if( substr($m,0,1) == 'w') $s = swap($s, (int) substr($m,1)); //echo $m." - ".$s."<br />"; } return $s; } function swap($a, $b) { $c = $a[0]; $a[0] = $a[$b]; $a[$b] = $c; return $a; } function getpage($url) { // fetch data $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); $data = curl_exec($curl); curl_close($curl); return $data; } function debug($str) { if(is_array($str) || is_object($str)) { print '<pre>'; print_r($str); print '</pre>'; } else echo $str; } //echo '<div>'.htmlspecialchars($data).'</div>'; ?>
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function curl_init() in /in/nRC1Z:86 Stack trace: #0 /in/nRC1Z(13): getpage(NULL) #1 {main} thrown in /in/nRC1Z on line 86
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
42.3 ms | 401 KiB | 8 Q