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>'; ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 42, Position 2 = 51
Branch analysis from position: 42
2 jumps found. (Code = 78) Position 1 = 43, Position 2 = 51
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
filename:       /in/nRC1Z
function name:  (null)
number of ops:  53
compiled vars:  !0 = $resolution, !1 = $data, !2 = $match, !3 = $o, !4 = $links, !5 = $link, !6 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 1
          2        DO_ICALL                                                 
    5     3        ASSIGN_DIM                                               !0, 22
          4        OP_DATA                                                  '720_mp4'
    6     5        ASSIGN_DIM                                               !0, 18
          6        OP_DATA                                                  '360_mp4'
    7     7        ASSIGN_DIM                                               !0, 43
          8        OP_DATA                                                  '360_webm'
    8     9        ASSIGN_DIM                                               !0, 5
         10        OP_DATA                                                  '240p_flv'
    9    11        ASSIGN_DIM                                               !0, 36
         12        OP_DATA                                                  '240p_3gp'
   10    13        ASSIGN_DIM                                               !0, 17
         14        OP_DATA                                                  '114p_3gp'
   13    15        INIT_FCALL_BY_NAME                                       'getpage'
         16        CHECK_FUNC_ARG                                           
         17        FETCH_FUNC_ARG               global              $14     '_GET'
         18        FETCH_DIM_FUNC_ARG                               $15     $14, 'url'
         19        SEND_FUNC_ARG                                            $15
         20        DO_FCALL                                      0  $16     
         21        ASSIGN                                                   !1, $16
   16    22        INIT_FCALL                                               'preg_match'
         23        SEND_VAL                                                 '%2Fytplayer.config+%3D+%7B%28.%2A%3F%29%7D%3B%2F'
         24        SEND_VAR                                                 !1
         25        SEND_REF                                                 !2
         26        DO_ICALL                                                 
   21    27        INIT_FCALL                                               'json_decode'
         28        FETCH_DIM_R                                      ~19     !2, 1
         29        CONCAT                                           ~20     '%7B', ~19
         30        CONCAT                                           ~21     ~20, '%7D'
         31        SEND_VAL                                                 ~21
         32        DO_ICALL                                         $22     
         33        ASSIGN                                                   !3, $22
   23    34        INIT_FCALL                                               'explode'
         35        SEND_VAL                                                 '%2C'
         36        FETCH_OBJ_R                                      ~24     !3, 'args'
         37        FETCH_OBJ_R                                      ~25     ~24, 'url_encoded_fmt_stream_map'
         38        SEND_VAL                                                 ~25
         39        DO_ICALL                                         $26     
         40        ASSIGN                                                   !4, $26
   25    41      > FE_RESET_R                                       $28     !4, ->51
         42    > > FE_FETCH_R                                               $28, !5, ->51
   27    43    >   INIT_FCALL                                               'parse_str'
         44        SEND_VAR                                                 !5
         45        SEND_REF                                                 !6
         46        DO_ICALL                                                 
   29    47        INIT_FCALL                                               'print_r'
         48        SEND_VAR                                                 !6
         49        DO_ICALL                                                 
   25    50      > JMP                                                      ->42
         51    >   FE_FREE                                                  $28
  110    52      > RETURN                                                   1

Function decrypt_sig:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 54
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 54
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 36
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 53
Branch analysis from position: 53
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 53
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 53
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 54
filename:       /in/nRC1Z
function name:  decrypt_sig
number of ops:  57
compiled vars:  !0 = $s, !1 = $player_id, !2 = $algo, !3 = $method, !4 = $m
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   54     2        ASSIGN                                                   !2, <array>
   59     3        INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '+'
          5        FETCH_DIM_R                                      ~6      !2, !1
          6        SEND_VAL                                                 ~6
          7        DO_ICALL                                         $7      
          8        ASSIGN                                                   !3, $7
   61     9      > FE_RESET_R                                       $9      !3, ->54
         10    > > FE_FETCH_R                                               $9, !4, ->54
   63    11    >   IS_EQUAL                                                 !4, 'r'
         12      > JMPZ                                                     ~10, ->18
   64    13    >   INIT_FCALL                                               'strrev'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $11     
         16        ASSIGN                                                   !0, $11
         17      > JMP                                                      ->53
   65    18    >   INIT_FCALL                                               'substr'
         19        SEND_VAR                                                 !4
         20        SEND_VAL                                                 0
         21        SEND_VAL                                                 1
         22        DO_ICALL                                         $13     
         23        IS_EQUAL                                                 $13, 's'
         24      > JMPZ                                                     ~14, ->36
   66    25    >   INIT_FCALL                                               'substr'
         26        SEND_VAR                                                 !0
         27        INIT_FCALL                                               'substr'
         28        SEND_VAR                                                 !4
         29        SEND_VAL                                                 1
         30        DO_ICALL                                         $15     
         31        CAST                                          4  ~16     $15
         32        SEND_VAL                                                 ~16
         33        DO_ICALL                                         $17     
         34        ASSIGN                                                   !0, $17
         35      > JMP                                                      ->53
   67    36    >   INIT_FCALL                                               'substr'
         37        SEND_VAR                                                 !4
         38        SEND_VAL                                                 0
         39        SEND_VAL                                                 1
         40        DO_ICALL                                         $19     
         41        IS_EQUAL                                                 $19, 'w'
         42      > JMPZ                                                     ~20, ->53
   68    43    >   INIT_FCALL_BY_NAME                                       'swap'
         44        SEND_VAR_EX                                              !0
         45        INIT_FCALL                                               'substr'
         46        SEND_VAR                                                 !4
         47        SEND_VAL                                                 1
         48        DO_ICALL                                         $21     
         49        CAST                                          4  ~22     $21
         50        SEND_VAL_EX                                              ~22
         51        DO_FCALL                                      0  $23     
         52        ASSIGN                                                   !0, $23
   61    53    > > JMP                                                      ->10
         54    >   FE_FREE                                                  $9
   75    55      > RETURN                                                   !0
   76    56*     > RETURN                                                   null

End of function decrypt_sig

Function swap:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nRC1Z
function name:  swap
number of ops:  11
compiled vars:  !0 = $a, !1 = $b, !2 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   77     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   78     2        FETCH_DIM_R                                      ~3      !0, 0
          3        ASSIGN                                                   !2, ~3
   79     4        FETCH_DIM_R                                      ~6      !0, !1
          5        ASSIGN_DIM                                               !0, 0
          6        OP_DATA                                                  ~6
   80     7        ASSIGN_DIM                                               !0, !1
          8        OP_DATA                                                  !2
   81     9      > RETURN                                                   !0
   82    10*     > RETURN                                                   null

End of function swap

Function getpage:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nRC1Z
function name:  getpage
number of ops:  37
compiled vars:  !0 = $url, !1 = $curl, !2 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   83     0  E >   RECV                                             !0      
   86     1        INIT_FCALL_BY_NAME                                       'curl_init'
          2        DO_FCALL                                      0  $3      
          3        ASSIGN                                                   !1, $3
   87     4        INIT_FCALL_BY_NAME                                       'curl_setopt'
          5        SEND_VAR_EX                                              !1
          6        FETCH_CONSTANT                                   ~5      'CURLOPT_URL'
          7        SEND_VAL_EX                                              ~5
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
   88    10        INIT_FCALL_BY_NAME                                       'curl_setopt'
         11        SEND_VAR_EX                                              !1
         12        FETCH_CONSTANT                                   ~7      'CURLOPT_RETURNTRANSFER'
         13        SEND_VAL_EX                                              ~7
         14        SEND_VAL_EX                                              <true>
         15        DO_FCALL                                      0          
   89    16        INIT_FCALL_BY_NAME                                       'curl_setopt'
         17        SEND_VAR_EX                                              !1
         18        FETCH_CONSTANT                                   ~9      'CURLOPT_SSL_VERIFYPEER'
         19        SEND_VAL_EX                                              ~9
         20        SEND_VAL_EX                                              <false>
         21        DO_FCALL                                      0          
   90    22        INIT_FCALL_BY_NAME                                       'curl_setopt'
         23        SEND_VAR_EX                                              !1
         24        FETCH_CONSTANT                                   ~11     'CURLOPT_SSL_VERIFYHOST'
         25        SEND_VAL_EX                                              ~11
         26        SEND_VAL_EX                                              <false>
         27        DO_FCALL                                      0          
   91    28        INIT_FCALL_BY_NAME                                       'curl_exec'
         29        SEND_VAR_EX                                              !1
         30        DO_FCALL                                      0  $13     
         31        ASSIGN                                                   !2, $13
   92    32        INIT_FCALL_BY_NAME                                       'curl_close'
         33        SEND_VAR_EX                                              !1
         34        DO_FCALL                                      0          
   93    35      > RETURN                                                   !2
   94    36*     > RETURN                                                   null

End of function getpage

Function debug:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 12
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
filename:       /in/nRC1Z
function name:  debug
number of ops:  14
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   95     0  E >   RECV                                             !0      
   97     1        TYPE_CHECK                                  128  ~1      !0
          2      > JMPNZ_EX                                         ~1      ~1, ->5
          3    >   TYPE_CHECK                                  256  ~2      !0
          4        BOOL                                             ~1      ~2
          5    > > JMPZ                                                     ~1, ->12
   99     6    >   ECHO                                                     '%3Cpre%3E'
  100     7        INIT_FCALL                                               'print_r'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
  101    10        ECHO                                                     '%3C%2Fpre%3E'
         11      > JMP                                                      ->13
  104    12    >   ECHO                                                     !0
  105    13    > > RETURN                                                   null

End of function debug

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.62 ms | 1412 KiB | 29 Q