3v4l.org

run code in 500+ PHP versions simultaneously
<?php $default = 'hacs.xyz'; $url = ltrim($_GET['u'] ?? $_SERVER['QUERY_STRING'] ?? $_SERVER['REQUEST_URI'] ?? '', '/') ?: $default; $url = preg_replace('#^index\.php/#i', '', $url); if (in_array($url, ['', 'favicon.ico', 'opensearch.xml'])) { exit(); } if (!preg_match('/https?:/i', $url)) { $url = "https://$url"; } list($body, $headers) = request($url); foreach ($headers as $k => $v) { if (in_array(strtolower($k), ['content-type', 'content-encoding'])) { header("$k: $v"); } } echo $body; function request($url) { error_log($url); $ua = $_SERVER['HTTP_USER_AGENT'] ?? 'Mozilla/5.0 Chrome/139'; $headers = ["Content-Type: $ua\r\n"]; if ($ref = $_SERVER['HTTP_REFERER'] ?? '') { $headers[] = "Referer: $ref\r\n"; } $http = [ 'method' => 'GET', 'header' => join($headers), ]; $context = stream_context_create(compact('http')); $body = file_get_contents($url, false, $context); $headers = array_reduce($http_response_header ?? [], function ($dat, $head) { $arr = explode(':', $head, 2); if (isset($arr[1])) { $dat[$arr[0]] = trim($arr[1]); } return $dat; }, []); if ($location = $headers['Location'] ?? $headers['location'] ?? null) { if (str_starts_with($location, '/')) { $schema = parse_url($url, PHP_URL_SCHEME); $host = parse_url($url, PHP_URL_HOST); $location = "$schema://$host$location"; } return request($location); } return [$body, $headers]; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
1 jumps found. (Code = 61) Position 1 = -2
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 33
Branch analysis from position: 30
2 jumps found. (Code = 77) Position 1 = 42, Position 2 = 56
Branch analysis from position: 42
2 jumps found. (Code = 78) Position 1 = 43, Position 2 = 56
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 49, Position 2 = 55
Branch analysis from position: 49
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 55
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 56
Branch analysis from position: 33
filename:       /in/aoBfV
function name:  (null)
number of ops:  59
compiled vars:  !0 = $default, !1 = $url, !2 = $body, !3 = $headers, !4 = $v, !5 = $k
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, 'hacs.xyz'
    4     1        INIT_FCALL                                                   'ltrim'
          2        FETCH_IS                                             ~7      '_GET'
          3        FETCH_DIM_IS                                         ~8      ~7, 'u'
          4        COALESCE                                             ~9      ~8
          5        FETCH_IS                                             ~10     '_SERVER'
          6        FETCH_DIM_IS                                         ~11     ~10, 'QUERY_STRING'
          7        COALESCE                                             ~12     ~11
          8        FETCH_IS                                             ~13     '_SERVER'
          9        FETCH_DIM_IS                                         ~14     ~13, 'REQUEST_URI'
         10        COALESCE                                             ~15     ~14
         11        QM_ASSIGN                                            ~15     ''
         12        QM_ASSIGN                                            ~12     ~15
         13        QM_ASSIGN                                            ~9      ~12
         14        SEND_VAL                                                     ~9
         15        SEND_VAL                                                     '%2F'
         16        DO_ICALL                                             $16     
         17        JMP_SET                                              ~17     $16, ->19
         18        QM_ASSIGN                                            ~17     !0
         19        ASSIGN                                                       !1, ~17
    5    20        FRAMELESS_ICALL_3                preg_replace        ~19     '%23%5Eindex%5C.php%2F%23i', ''
         21        OP_DATA                                                      !1
         22        ASSIGN                                                       !1, ~19
    6    23        IN_ARRAY                                                     !1, <array>
         24      > JMPZ                                                         ~21, ->27
    7    25    > > INIT_FCALL                                                   'exit'
         26*       DO_ICALL                                                     
    9    27    >   FRAMELESS_ICALL_2                preg_match          ~23     '%2Fhttps%3F%3A%2Fi', !1
         28        BOOL_NOT                                             ~24     ~23
         29      > JMPZ                                                         ~24, ->33
   10    30    >   NOP                                                          
         31        FAST_CONCAT                                          ~25     'https%3A%2F%2F', !1
         32        ASSIGN                                                       !1, ~25
   13    33    >   INIT_FCALL_BY_NAME                                           'request'
         34        SEND_VAR_EX                                                  !1
         35        DO_FCALL                                          0  $27     
         36        FETCH_LIST_R                                         $28     $27, 0
         37        ASSIGN                                                       !2, $28
         38        FETCH_LIST_R                                         $30     $27, 1
         39        ASSIGN                                                       !3, $30
         40        FREE                                                         $27
   14    41      > FE_RESET_R                                           $32     !3, ->56
         42    > > FE_FETCH_R                                           ~33     $32, !4, ->56
         43    >   ASSIGN                                                       !5, ~33
   15    44        INIT_FCALL                                                   'strtolower'
         45        SEND_VAR                                                     !5
         46        DO_ICALL                                             $35     
         47        IN_ARRAY                                                     $35, <array>
         48      > JMPZ                                                         ~36, ->55
   16    49    >   INIT_FCALL                                                   'header'
         50        ROPE_INIT                                         3  ~38     !5
         51        ROPE_ADD                                          1  ~38     ~38, '%3A+'
         52        ROPE_END                                          2  ~37     ~38, !4
         53        SEND_VAL                                                     ~37
         54        DO_ICALL                                                     
   14    55    > > JMP                                                          ->42
         56    >   FE_FREE                                                      $32
   19    57        ECHO                                                         !2
   51    58      > RETURN                                                       1

Function request:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 25
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 61, Position 2 = 82
Branch analysis from position: 61
2 jumps found. (Code = 43) Position 1 = 63, Position 2 = 78
Branch analysis from position: 63
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 78
Branch analysis from position: 82
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/aoBfV
function name:  request
number of ops:  86
compiled vars:  !0 = $url, !1 = $ua, !2 = $headers, !3 = $ref, !4 = $http, !5 = $context, !6 = $body, !7 = $http_response_header, !8 = $location, !9 = $schema, !10 = $host
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   RECV                                                 !0      
   23     1        INIT_FCALL                                                   'error_log'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                                     
   24     4        FETCH_IS                                             ~12     '_SERVER'
          5        FETCH_DIM_IS                                         ~13     ~12, 'HTTP_USER_AGENT'
          6        COALESCE                                             ~14     ~13
          7        QM_ASSIGN                                            ~14     'Mozilla%2F5.0+Chrome%2F139'
          8        ASSIGN                                                       !1, ~14
   25     9        ROPE_INIT                                         3  ~17     'Content-Type%3A+'
         10        ROPE_ADD                                          1  ~17     ~17, !1
         11        ROPE_END                                          2  ~16     ~17, '%0D%0A'
         12        INIT_ARRAY                                           ~19     ~16
         13        ASSIGN                                                       !2, ~19
   26    14        FETCH_IS                                             ~21     '_SERVER'
         15        FETCH_DIM_IS                                         ~22     ~21, 'HTTP_REFERER'
         16        COALESCE                                             ~23     ~22
         17        QM_ASSIGN                                            ~23     ''
         18        ASSIGN                                               ~24     !3, ~23
         19      > JMPZ                                                         ~24, ->25
   27    20    >   ROPE_INIT                                         3  ~27     'Referer%3A+'
         21        ROPE_ADD                                          1  ~27     ~27, !3
         22        ROPE_END                                          2  ~26     ~27, '%0D%0A'
         23        ASSIGN_DIM                                                   !2
         24        OP_DATA                                                      ~26
   30    25    >   INIT_ARRAY                                           ~29     'GET', 'method'
   31    26        INIT_FCALL                                                   'join'
         27        SEND_VAR                                                     !2
         28        DO_ICALL                                             $30     
         29        ADD_ARRAY_ELEMENT                                    ~29     $30, 'header'
   29    30        ASSIGN                                                       !4, ~29
   33    31        INIT_FCALL                                                   'stream_context_create'
         32        INIT_FCALL                                                   'compact'
         33        SEND_VAL                                                     'http'
         34        DO_ICALL                                             $32     
         35        SEND_VAR                                                     $32
         36        DO_ICALL                                             $33     
         37        ASSIGN                                                       !5, $33
   34    38        INIT_FCALL                                                   'file_get_contents'
         39        SEND_VAR                                                     !0
         40        SEND_VAL                                                     <false>
         41        SEND_VAR                                                     !5
         42        DO_ICALL                                             $35     
         43        ASSIGN                                                       !6, $35
   35    44        INIT_FCALL                                                   'array_reduce'
         45        COALESCE                                             ~37     !7
         46        QM_ASSIGN                                            ~37     <array>
         47        SEND_VAL                                                     ~37
         48        DECLARE_LAMBDA_FUNCTION                              ~38     [0]
   41    49        SEND_VAL                                                     ~38
         50        SEND_VAL                                                     <array>
   35    51        DO_ICALL                                             $39     
         52        ASSIGN                                                       !2, $39
   42    53        FETCH_DIM_IS                                         ~41     !2, 'Location'
         54        COALESCE                                             ~42     ~41
         55        FETCH_DIM_IS                                         ~43     !2, 'location'
         56        COALESCE                                             ~44     ~43
         57        QM_ASSIGN                                            ~44     null
         58        QM_ASSIGN                                            ~42     ~44
         59        ASSIGN                                               ~45     !8, ~42
         60      > JMPZ                                                         ~45, ->82
   43    61    >   FRAMELESS_ICALL_2                str_starts_with      ~46     !8, '%2F'
         62      > JMPZ                                                         ~46, ->78
   44    63    >   INIT_FCALL                                                   'parse_url'
         64        SEND_VAR                                                     !0
         65        SEND_VAL                                                     0
         66        DO_ICALL                                             $47     
         67        ASSIGN                                                       !9, $47
   45    68        INIT_FCALL                                                   'parse_url'
         69        SEND_VAR                                                     !0
         70        SEND_VAL                                                     1
         71        DO_ICALL                                             $49     
         72        ASSIGN                                                       !10, $49
   46    73        ROPE_INIT                                         4  ~52     !9
         74        ROPE_ADD                                          1  ~52     ~52, '%3A%2F%2F'
         75        ROPE_ADD                                          2  ~52     ~52, !10
         76        ROPE_END                                          3  ~51     ~52, !8
         77        ASSIGN                                                       !8, ~51
   48    78    >   INIT_FCALL_BY_NAME                                           'request'
         79        SEND_VAR_EX                                                  !8
         80        DO_FCALL                                          0  $55     
         81      > RETURN                                                       $55
   50    82    >   INIT_ARRAY                                           ~56     !6
         83        ADD_ARRAY_ELEMENT                                    ~56     !2
         84      > RETURN                                                       ~56
   51    85*     > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/aoBfV
function name:  {closure:request():35}
number of ops:  17
compiled vars:  !0 = $dat, !1 = $head, !2 = $arr
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   35     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   36     2        INIT_FCALL                                                   'explode'
          3        SEND_VAL                                                     '%3A'
          4        SEND_VAR                                                     !1
          5        SEND_VAL                                                     2
          6        DO_ICALL                                             $3      
          7        ASSIGN                                                       !2, $3
   37     8        ISSET_ISEMPTY_DIM_OBJ                             0          !2, 1
          9      > JMPZ                                                         ~5, ->15
   38    10    >   FETCH_DIM_R                                          ~6      !2, 0
         11        FETCH_DIM_R                                          ~8      !2, 1
         12        FRAMELESS_ICALL_1                trim                ~9      ~8
         13        ASSIGN_DIM                                                   !0, ~6
         14        OP_DATA                                                      ~9
   40    15    > > RETURN                                                       !0
   41    16*     > RETURN                                                       null

End of Dynamic Function 0

End of function request

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
191.33 ms | 1519 KiB | 34 Q