3v4l.org

run code in 300+ PHP versions simultaneously
<?php //Enter your code here, enjoy! class ICObenchAPI { private $privateKey = '196c979a-e3a5-40cc-8bf8-55edbb4af14b'; private $publicKey = '570d742e-21c0-4a8b-9f13-fbc30f00b804'; private $apiUrl = 'https://icobench.com/api/v1/'; public $result; public function getICOs($type = 'all', $data = ''){ return $this->send('icos/' . $type, $data); } public function getICO($icoId, $data = ''){ return $this->send('ico/' . $icoId, $data); } public function getOther($type){ return $this->send('other/' . $type, ''); } private function send($action, $data){ $dataJson = json_encode($data); echo $sig = base64_encode(hash_hmac('sha384', $dataJson, $this->privateKey, true)); echo '*'; echo strlen($dataJson); echo '*'; echo $this->publicKey; echo '*'; echo $sig; echo '*'; echo $dataJson; $ch = curl_init($this->apiUrl . $action); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $dataJson); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Content-Length: ' . strlen($dataJson), 'X-ICObench-Key: ' . $this->publicKey, 'X-ICObench-Sig: ' . $sig) ); $reply = curl_exec($ch); $ff = $reply; $reply = json_decode($reply,true); if(isset($reply['error'])){ $this->result = $reply['error']; return false; }else if(isset($reply['message'])){ $this->result = $reply['message']; return true; }else if(isset($reply)){ $this->result = json_encode($reply); return true; }else{ $this->result = htmlspecialchars($ff); return false; } } public function result(){ return $this->result; } } $api = new ICObenchAPI(); $api->getICOs("all"); echo $api->result;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ou9m5
function name:  (null)
number of ops:  9
compiled vars:  !0 = $api
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   69     0  E >   NEW                                              $1      'ICObenchAPI'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   70     3        INIT_METHOD_CALL                                         !0, 'getICOs'
          4        SEND_VAL_EX                                              'all'
          5        DO_FCALL                                      0          
   72     6        FETCH_OBJ_R                                      ~5      !0, 'result'
          7        ECHO                                                     ~5
          8      > RETURN                                                   1

Class ICObenchAPI:
Function geticos:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ou9m5
function name:  getICOs
number of ops:  9
compiled vars:  !0 = $type, !1 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV_INIT                                        !0      'all'
          1        RECV_INIT                                        !1      ''
   12     2        INIT_METHOD_CALL                                         'send'
          3        CONCAT                                           ~2      'icos%2F', !0
          4        SEND_VAL_EX                                              ~2
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0  $3      
          7      > RETURN                                                   $3
   13     8*     > RETURN                                                   null

End of function geticos

Function getico:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ou9m5
function name:  getICO
number of ops:  9
compiled vars:  !0 = $icoId, !1 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      ''
   15     2        INIT_METHOD_CALL                                         'send'
          3        CONCAT                                           ~2      'ico%2F', !0
          4        SEND_VAL_EX                                              ~2
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0  $3      
          7      > RETURN                                                   $3
   16     8*     > RETURN                                                   null

End of function getico

Function getother:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ou9m5
function name:  getOther
number of ops:  8
compiled vars:  !0 = $type
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        INIT_METHOD_CALL                                         'send'
          2        CONCAT                                           ~1      'other%2F', !0
          3        SEND_VAL_EX                                              ~1
          4        SEND_VAL_EX                                              ''
          5        DO_FCALL                                      0  $2      
          6      > RETURN                                                   $2
   19     7*     > RETURN                                                   null

End of function getother

Function send:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 79, Position 2 = 84
Branch analysis from position: 79
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 84
2 jumps found. (Code = 43) Position 1 = 86, Position 2 = 91
Branch analysis from position: 86
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 91
2 jumps found. (Code = 43) Position 1 = 93, Position 2 = 100
Branch analysis from position: 93
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 100
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ou9m5
function name:  send
number of ops:  107
compiled vars:  !0 = $action, !1 = $data, !2 = $dataJson, !3 = $sig, !4 = $ch, !5 = $reply, !6 = $ff
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   23     2        INIT_FCALL                                               'json_encode'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !2, $7
   24     6        INIT_FCALL                                               'base64_encode'
          7        INIT_FCALL                                               'hash_hmac'
          8        SEND_VAL                                                 'sha384'
          9        SEND_VAR                                                 !2
         10        FETCH_OBJ_R                                      ~9      'privateKey'
         11        SEND_VAL                                                 ~9
         12        SEND_VAL                                                 <true>
         13        DO_ICALL                                         $10     
         14        SEND_VAR                                                 $10
         15        DO_ICALL                                         $11     
         16        ASSIGN                                           ~12     !3, $11
         17        ECHO                                                     ~12
   25    18        ECHO                                                     '%2A'
   26    19        STRLEN                                           ~13     !2
         20        ECHO                                                     ~13
   27    21        ECHO                                                     '%2A'
   28    22        FETCH_OBJ_R                                      ~14     'publicKey'
         23        ECHO                                                     ~14
   29    24        ECHO                                                     '%2A'
   30    25        ECHO                                                     !3
   31    26        ECHO                                                     '%2A'
   32    27        ECHO                                                     !2
   34    28        INIT_FCALL_BY_NAME                                       'curl_init'
         29        FETCH_OBJ_R                                      ~15     'apiUrl'
         30        CONCAT                                           ~16     ~15, !0
         31        SEND_VAL_EX                                              ~16
         32        DO_FCALL                                      0  $17     
         33        ASSIGN                                                   !4, $17
   35    34        INIT_FCALL_BY_NAME                                       'curl_setopt'
         35        SEND_VAR_EX                                              !4
         36        FETCH_CONSTANT                                   ~19     'CURLOPT_CUSTOMREQUEST'
         37        SEND_VAL_EX                                              ~19
         38        SEND_VAL_EX                                              'POST'
         39        DO_FCALL                                      0          
   36    40        INIT_FCALL_BY_NAME                                       'curl_setopt'
         41        SEND_VAR_EX                                              !4
         42        FETCH_CONSTANT                                   ~21     'CURLOPT_POSTFIELDS'
         43        SEND_VAL_EX                                              ~21
         44        SEND_VAR_EX                                              !2
         45        DO_FCALL                                      0          
   37    46        INIT_FCALL_BY_NAME                                       'curl_setopt'
         47        SEND_VAR_EX                                              !4
         48        FETCH_CONSTANT                                   ~23     'CURLOPT_RETURNTRANSFER'
         49        SEND_VAL_EX                                              ~23
         50        SEND_VAL_EX                                              <true>
         51        DO_FCALL                                      0          
   38    52        INIT_FCALL_BY_NAME                                       'curl_setopt'
         53        SEND_VAR_EX                                              !4
         54        FETCH_CONSTANT                                   ~25     'CURLOPT_HTTPHEADER'
         55        SEND_VAL_EX                                              ~25
   39    56        INIT_ARRAY                                       ~26     'Content-Type%3A+application%2Fjson'
   40    57        STRLEN                                           ~27     !2
         58        CONCAT                                           ~28     'Content-Length%3A+', ~27
         59        ADD_ARRAY_ELEMENT                                ~26     ~28
   41    60        FETCH_OBJ_R                                      ~29     'publicKey'
         61        CONCAT                                           ~30     'X-ICObench-Key%3A+', ~29
         62        ADD_ARRAY_ELEMENT                                ~26     ~30
   42    63        CONCAT                                           ~31     'X-ICObench-Sig%3A+', !3
         64        ADD_ARRAY_ELEMENT                                ~26     ~31
         65        SEND_VAL_EX                                              ~26
         66        DO_FCALL                                      0          
   45    67        INIT_FCALL_BY_NAME                                       'curl_exec'
         68        SEND_VAR_EX                                              !4
         69        DO_FCALL                                      0  $33     
         70        ASSIGN                                                   !5, $33
   46    71        ASSIGN                                                   !6, !5
   47    72        INIT_FCALL                                               'json_decode'
         73        SEND_VAR                                                 !5
         74        SEND_VAL                                                 <true>
         75        DO_ICALL                                         $36     
         76        ASSIGN                                                   !5, $36
   49    77        ISSET_ISEMPTY_DIM_OBJ                         0          !5, 'error'
         78      > JMPZ                                                     ~38, ->84
   50    79    >   FETCH_DIM_R                                      ~40     !5, 'error'
         80        ASSIGN_OBJ                                               'result'
         81        OP_DATA                                                  ~40
   51    82      > RETURN                                                   <false>
         83*       JMP                                                      ->106
   52    84    >   ISSET_ISEMPTY_DIM_OBJ                         0          !5, 'message'
         85      > JMPZ                                                     ~41, ->91
   53    86    >   FETCH_DIM_R                                      ~43     !5, 'message'
         87        ASSIGN_OBJ                                               'result'
         88        OP_DATA                                                  ~43
   54    89      > RETURN                                                   <true>
         90*       JMP                                                      ->106
   55    91    >   ISSET_ISEMPTY_CV                                         !5
         92      > JMPZ                                                     ~44, ->100
   56    93    >   INIT_FCALL                                               'json_encode'
         94        SEND_VAR                                                 !5
         95        DO_ICALL                                         $46     
         96        ASSIGN_OBJ                                               'result'
         97        OP_DATA                                                  $46
   57    98      > RETURN                                                   <true>
         99*       JMP                                                      ->106
   59   100    >   INIT_FCALL                                               'htmlspecialchars'
        101        SEND_VAR                                                 !6
        102        DO_ICALL                                         $48     
        103        ASSIGN_OBJ                                               'result'
        104        OP_DATA                                                  $48
   60   105      > RETURN                                                   <false>
   62   106*     > RETURN                                                   null

End of function send

Function result:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ou9m5
function name:  result
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   65     0  E >   FETCH_OBJ_R                                      ~0      'result'
          1      > RETURN                                                   ~0
   66     2*     > RETURN                                                   null

End of function result

End of class ICObenchAPI.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.11 ms | 1419 KiB | 23 Q