3v4l.org

run code in 300+ PHP versions simultaneously
<?php const URL_ROOT = 'http://www.jd.com'; $host = parse_url(URL_ROOT, PHP_URL_HOST) or die('Invalid URL_ROOT'); $url = URL_ROOT . $_SERVER['REQUEST_URI']; // Request URL $ch = curl_init($url) or die('curl_init failed.'); // Request Method curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $_SERVER['REQUEST_METHOD']); // Request Headers $headers = getallheaders(); $headers['Host'] = $host; $ch_headers = array(); foreach ($headers as $name => $value) $ch_headers[] = "$name: $value"; curl_setopt($ch, CURLOPT_HTTPHEADER, $ch_headers); // Request Body curl_setopt($ch, CURLOPT_POSTFIELDS, file_get_contents("php://input")); // Send curl_setopt($ch, CURLOPT_VERBOSE, true); curl_setopt($ch, CURLOPT_HEADER, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch) or die('curl_exec failed.'); $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); curl_close($ch); // Response Header $header = substr($response, 0, $header_size); $headers = explode("\r\n", $header); foreach ($headers as $header) header($header); // Response Body $body = substr($response, $header_size); echo $body;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 10
2 jumps found. (Code = 47) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 77) Position 1 = 38, Position 2 = 46
Branch analysis from position: 38
2 jumps found. (Code = 78) Position 1 = 39, Position 2 = 46
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 46
2 jumps found. (Code = 47) Position 1 = 85, Position 2 = 87
Branch analysis from position: 85
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 87
2 jumps found. (Code = 77) Position 1 = 108, Position 2 = 113
Branch analysis from position: 108
2 jumps found. (Code = 78) Position 1 = 109, Position 2 = 113
Branch analysis from position: 109
1 jumps found. (Code = 42) Position 1 = 108
Branch analysis from position: 108
Branch analysis from position: 113
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 113
Branch analysis from position: 46
filename:       /in/ZS3FN
function name:  (null)
number of ops:  121
compiled vars:  !0 = $host, !1 = $url, !2 = $ch, !3 = $headers, !4 = $ch_headers, !5 = $value, !6 = $name, !7 = $response, !8 = $header_size, !9 = $header, !10 = $body
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CONST                                            'URL_ROOT', 'http%3A%2F%2Fwww.jd.com'
    4     1        INIT_FCALL                                               'parse_url'
          2        FETCH_CONSTANT                                   ~11     'URL_ROOT'
          3        SEND_VAL                                                 ~11
          4        SEND_VAL                                                 1
          5        DO_ICALL                                         $12     
          6        ASSIGN                                           ~13     !0, $12
          7      > JMPNZ_EX                                         ~13     ~13, ->10
          8    > > EXIT                                                     'Invalid+URL_ROOT'
          9*       BOOL                                             ~13     <true>
    5    10    >   FETCH_CONSTANT                                   ~14     'URL_ROOT'
         11        FETCH_R                      global              ~15     '_SERVER'
         12        FETCH_DIM_R                                      ~16     ~15, 'REQUEST_URI'
         13        CONCAT                                           ~17     ~14, ~16
         14        ASSIGN                                                   !1, ~17
    8    15        INIT_FCALL_BY_NAME                                       'curl_init'
         16        SEND_VAR_EX                                              !1
         17        DO_FCALL                                      0  $19     
         18        ASSIGN                                           ~20     !2, $19
         19      > JMPNZ_EX                                         ~20     ~20, ->22
         20    > > EXIT                                                     'curl_init+failed.'
         21*       BOOL                                             ~20     <true>
   11    22    >   INIT_FCALL_BY_NAME                                       'curl_setopt'
         23        SEND_VAR_EX                                              !2
         24        FETCH_CONSTANT                                   ~21     'CURLOPT_CUSTOMREQUEST'
         25        SEND_VAL_EX                                              ~21
         26        CHECK_FUNC_ARG                                           
         27        FETCH_FUNC_ARG               global              $22     '_SERVER'
         28        FETCH_DIM_FUNC_ARG                               $23     $22, 'REQUEST_METHOD'
         29        SEND_FUNC_ARG                                            $23
         30        DO_FCALL                                      0          
   14    31        INIT_FCALL_BY_NAME                                       'getallheaders'
         32        DO_FCALL                                      0  $25     
         33        ASSIGN                                                   !3, $25
   15    34        ASSIGN_DIM                                               !3, 'Host'
         35        OP_DATA                                                  !0
   16    36        ASSIGN                                                   !4, <array>
   17    37      > FE_RESET_R                                       $29     !3, ->46
         38    > > FE_FETCH_R                                       ~30     $29, !5, ->46
         39    >   ASSIGN                                                   !6, ~30
   18    40        ROPE_INIT                                     3  ~34     !6
         41        ROPE_ADD                                      1  ~34     ~34, '%3A+'
         42        ROPE_END                                      2  ~33     ~34, !5
         43        ASSIGN_DIM                                               !4
         44        OP_DATA                                                  ~33
   17    45      > JMP                                                      ->38
         46    >   FE_FREE                                                  $29
   19    47        INIT_FCALL_BY_NAME                                       'curl_setopt'
         48        SEND_VAR_EX                                              !2
         49        FETCH_CONSTANT                                   ~36     'CURLOPT_HTTPHEADER'
         50        SEND_VAL_EX                                              ~36
         51        SEND_VAR_EX                                              !4
         52        DO_FCALL                                      0          
   22    53        INIT_FCALL_BY_NAME                                       'curl_setopt'
         54        SEND_VAR_EX                                              !2
         55        FETCH_CONSTANT                                   ~38     'CURLOPT_POSTFIELDS'
         56        SEND_VAL_EX                                              ~38
         57        INIT_FCALL                                               'file_get_contents'
         58        SEND_VAL                                                 'php%3A%2F%2Finput'
         59        DO_ICALL                                         $39     
         60        SEND_VAR_NO_REF_EX                                       $39
         61        DO_FCALL                                      0          
   25    62        INIT_FCALL_BY_NAME                                       'curl_setopt'
         63        SEND_VAR_EX                                              !2
         64        FETCH_CONSTANT                                   ~41     'CURLOPT_VERBOSE'
         65        SEND_VAL_EX                                              ~41
         66        SEND_VAL_EX                                              <true>
         67        DO_FCALL                                      0          
   26    68        INIT_FCALL_BY_NAME                                       'curl_setopt'
         69        SEND_VAR_EX                                              !2
         70        FETCH_CONSTANT                                   ~43     'CURLOPT_HEADER'
         71        SEND_VAL_EX                                              ~43
         72        SEND_VAL_EX                                              <true>
         73        DO_FCALL                                      0          
   27    74        INIT_FCALL_BY_NAME                                       'curl_setopt'
         75        SEND_VAR_EX                                              !2
         76        FETCH_CONSTANT                                   ~45     'CURLOPT_RETURNTRANSFER'
         77        SEND_VAL_EX                                              ~45
         78        SEND_VAL_EX                                              <true>
         79        DO_FCALL                                      0          
   28    80        INIT_FCALL_BY_NAME                                       'curl_exec'
         81        SEND_VAR_EX                                              !2
         82        DO_FCALL                                      0  $47     
         83        ASSIGN                                           ~48     !7, $47
         84      > JMPNZ_EX                                         ~48     ~48, ->87
         85    > > EXIT                                                     'curl_exec+failed.'
         86*       BOOL                                             ~48     <true>
   29    87    >   INIT_FCALL_BY_NAME                                       'curl_getinfo'
         88        SEND_VAR_EX                                              !2
         89        FETCH_CONSTANT                                   ~49     'CURLINFO_HEADER_SIZE'
         90        SEND_VAL_EX                                              ~49
         91        DO_FCALL                                      0  $50     
         92        ASSIGN                                                   !8, $50
   30    93        INIT_FCALL_BY_NAME                                       'curl_close'
         94        SEND_VAR_EX                                              !2
         95        DO_FCALL                                      0          
   33    96        INIT_FCALL                                               'substr'
         97        SEND_VAR                                                 !7
         98        SEND_VAL                                                 0
         99        SEND_VAR                                                 !8
        100        DO_ICALL                                         $53     
        101        ASSIGN                                                   !9, $53
   34   102        INIT_FCALL                                               'explode'
        103        SEND_VAL                                                 '%0D%0A'
        104        SEND_VAR                                                 !9
        105        DO_ICALL                                         $55     
        106        ASSIGN                                                   !3, $55
   35   107      > FE_RESET_R                                       $57     !3, ->113
        108    > > FE_FETCH_R                                               $57, !9, ->113
   36   109    >   INIT_FCALL                                               'header'
        110        SEND_VAR                                                 !9
        111        DO_ICALL                                                 
   35   112      > JMP                                                      ->108
        113    >   FE_FREE                                                  $57
   39   114        INIT_FCALL                                               'substr'
        115        SEND_VAR                                                 !7
        116        SEND_VAR                                                 !8
        117        DO_ICALL                                         $59     
        118        ASSIGN                                                   !10, $59
   40   119        ECHO                                                     !10
        120      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.09 ms | 1404 KiB | 23 Q