3v4l.org

run code in 300+ PHP versions simultaneously
<?php function doHttpRequest($url, $post_data = NULL, $method = 'GET') { $ch = curl_init(); $options = array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_HEADER => FALSE, CURLOPT_CUSTOMREQUEST => $method ); if (isset($post_data)){ if($method == "POST") { $options[CURLOPT_POST] = TRUE; $options[CURLOPT_POSTFIELDS] = $post_data; } else { $options[CURLOPT_URL] = $url .'?'. http_build_query($post_data,'','&'); } } curl_setopt_array($ch, $options); $response = curl_exec($ch); curl_close($ch); return $response; } $post_data = array( 'apiKey' => 'bbd9f56b9ec239745931df1026baee74', 'campaign' => '4732' ); $data = doHttpRequest('http://theappreciationengine.com/api/top',$post_data); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r1khh
function name:  (null)
number of ops:  7
compiled vars:  !0 = $post_data, !1 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   ASSIGN                                                   !0, <array>
   30     1        INIT_FCALL                                               'dohttprequest'
          2        SEND_VAL                                                 'http%3A%2F%2Ftheappreciationengine.com%2Fapi%2Ftop'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !1, $3
   31     6      > RETURN                                                   1

Function dohttprequest:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 36
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 26
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 36
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
filename:       /in/r1khh
function name:  doHttpRequest
number of ops:  49
compiled vars:  !0 = $url, !1 = $post_data, !2 = $method, !3 = $ch, !4 = $options, !5 = $response
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
          2        RECV_INIT                                        !2      'GET'
    3     3        INIT_FCALL_BY_NAME                                       'curl_init'
          4        DO_FCALL                                      0  $6      
          5        ASSIGN                                                   !3, $6
    5     6        FETCH_CONSTANT                                   ~8      'CURLOPT_URL'
          7        INIT_ARRAY                                       ~9      !0, ~8
    6     8        FETCH_CONSTANT                                   ~10     'CURLOPT_RETURNTRANSFER'
    5     9        ADD_ARRAY_ELEMENT                                ~9      <true>, ~10
    7    10        FETCH_CONSTANT                                   ~11     'CURLOPT_HEADER'
    5    11        ADD_ARRAY_ELEMENT                                ~9      <false>, ~11
    8    12        FETCH_CONSTANT                                   ~12     'CURLOPT_CUSTOMREQUEST'
         13        ADD_ARRAY_ELEMENT                                ~9      !2, ~12
    4    14        ASSIGN                                                   !4, ~9
   10    15        ISSET_ISEMPTY_CV                                         !1
         16      > JMPZ                                                     ~14, ->36
   11    17    >   IS_EQUAL                                                 !2, 'POST'
         18      > JMPZ                                                     ~15, ->26
   12    19    >   FETCH_CONSTANT                                   ~16     'CURLOPT_POST'
         20        ASSIGN_DIM                                               !4, ~16
         21        OP_DATA                                                  <true>
   13    22        FETCH_CONSTANT                                   ~18     'CURLOPT_POSTFIELDS'
         23        ASSIGN_DIM                                               !4, ~18
         24        OP_DATA                                                  !1
         25      > JMP                                                      ->36
   15    26    >   FETCH_CONSTANT                                   ~20     'CURLOPT_URL'
         27        CONCAT                                           ~22     !0, '%3F'
         28        INIT_FCALL                                               'http_build_query'
         29        SEND_VAR                                                 !1
         30        SEND_VAL                                                 ''
         31        SEND_VAL                                                 '%26'
         32        DO_ICALL                                         $23     
         33        CONCAT                                           ~24     ~22, $23
         34        ASSIGN_DIM                                               !4, ~20
         35        OP_DATA                                                  ~24
   19    36    >   INIT_FCALL_BY_NAME                                       'curl_setopt_array'
         37        SEND_VAR_EX                                              !3
         38        SEND_VAR_EX                                              !4
         39        DO_FCALL                                      0          
   20    40        INIT_FCALL_BY_NAME                                       'curl_exec'
         41        SEND_VAR_EX                                              !3
         42        DO_FCALL                                      0  $26     
         43        ASSIGN                                                   !5, $26
   21    44        INIT_FCALL_BY_NAME                                       'curl_close'
         45        SEND_VAR_EX                                              !3
         46        DO_FCALL                                      0          
   22    47      > RETURN                                                   !5
   23    48*     > RETURN                                                   null

End of function dohttprequest

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.58 ms | 1394 KiB | 16 Q