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 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
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.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Fatal error: Call to undefined function curl_init() in /in/nRC1Z on line 86
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: curl_init() in /in/nRC1Z on line 86
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: curl_init() in /in/nRC1Z on line 86
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: curl_init() in /in/nRC1Z on line 86

preferences:
321.9 ms | 401 KiB | 460 Q