3v4l.org

run code in 300+ PHP versions simultaneously
<?php $apiID = '265C8E80'; $apiKey = 'D537CC92-8F71-4B08-91C7-B9602FE6988F'; // TaxCloud webservice $tcURL = 'https://api.taxcloud.net/1.0/Taxcloud/'; $customerID = 9; $cartItems = array(array('Index' => 0, 'ItemID' => '61', 'Price' => 123.00, 'Qty' => 1)); // set the cart id $cartID = '15'; $origin = array('Address1' => '1437 Minnesota Ave', 'City' => 'Duluth', 'State' => 'MN', 'Zip5' => '55802'); $dest = array('Address1' => '1145 Amarillo Ave', 'City' => 'Palo Alto', 'State' => 'CA', 'Zip5' => '94303',); $origin = array('Address1' => '333 place St.', 'City' => 'City', 'State' => 'AL', 'Zip5' => '36000'); $dest = array('Address1' => '111 someplace St.', 'City' => 'Seattle', 'State' => 'WA', 'Zip5' => '98101'); $exemptCert = null; $ch = curl_init($tcURL.'Lookup'); $params = array('apiLoginID' => $apiID, 'apiKey' => $apiKey, 'customerID' => $customerID, 'cartID' => $cartID, 'cartItems' => $cartItems, 'origin' => $origin, 'destination' => $dest, 'deliveredBySeller' => FALSE, 'exemptCert' => $exemptCert); curl_setopt_array($ch, array(CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_SSL_VERIFYPEER => FALSE, CURLOPT_HTTPHEADER => array('Content-Type: application/json'), // Calculate sales tax for cart CURLOPT_POSTFIELDS => json_encode($params))); $response = (curl_exec($ch)); //var_dump($params); $response = json_decode(curl_exec($ch)); //var_dump($response); if($response->ResponseType == 0){ foreach($response->Messages as $message){ echo '<br>Error : '.$message->ResponseType.' - '.$message->Message; } }else{ foreach($response->CartItemsResponse as $cartItem){ echo '<br>Cart Item '.$cartItem->CartItemIndex.' : Tax Amount '.$cartItem->TaxAmount; } } curl_close($ch);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 57, Position 2 = 69
Branch analysis from position: 57
2 jumps found. (Code = 77) Position 1 = 59, Position 2 = 67
Branch analysis from position: 59
2 jumps found. (Code = 78) Position 1 = 60, Position 2 = 67
Branch analysis from position: 60
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
Branch analysis from position: 67
1 jumps found. (Code = 42) Position 1 = 80
Branch analysis from position: 80
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 67
Branch analysis from position: 69
2 jumps found. (Code = 77) Position 1 = 71, Position 2 = 79
Branch analysis from position: 71
2 jumps found. (Code = 78) Position 1 = 72, Position 2 = 79
Branch analysis from position: 72
1 jumps found. (Code = 42) Position 1 = 71
Branch analysis from position: 71
Branch analysis from position: 79
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 79
filename:       /in/KBY0f
function name:  (null)
number of ops:  84
compiled vars:  !0 = $apiID, !1 = $apiKey, !2 = $tcURL, !3 = $customerID, !4 = $cartItems, !5 = $cartID, !6 = $origin, !7 = $dest, !8 = $exemptCert, !9 = $ch, !10 = $params, !11 = $response, !12 = $message, !13 = $cartItem
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '265C8E80'
    3     1        ASSIGN                                                   !1, 'D537CC92-8F71-4B08-91C7-B9602FE6988F'
    5     2        ASSIGN                                                   !2, 'https%3A%2F%2Fapi.taxcloud.net%2F1.0%2FTaxcloud%2F'
    6     3        ASSIGN                                                   !3, 9
    7     4        ASSIGN                                                   !4, <array>
   12     5        ASSIGN                                                   !5, '15'
   13     6        ASSIGN                                                   !6, <array>
   17     7        ASSIGN                                                   !7, <array>
   21     8        ASSIGN                                                   !6, <array>
   25     9        ASSIGN                                                   !7, <array>
   29    10        ASSIGN                                                   !8, null
   30    11        INIT_FCALL_BY_NAME                                       'curl_init'
         12        CONCAT                                           ~25     !2, 'Lookup'
         13        SEND_VAL_EX                                              ~25
         14        DO_FCALL                                      0  $26     
         15        ASSIGN                                                   !9, $26
   31    16        INIT_ARRAY                                       ~28     !0, 'apiLoginID'
   32    17        ADD_ARRAY_ELEMENT                                ~28     !1, 'apiKey'
   33    18        ADD_ARRAY_ELEMENT                                ~28     !3, 'customerID'
   34    19        ADD_ARRAY_ELEMENT                                ~28     !5, 'cartID'
   35    20        ADD_ARRAY_ELEMENT                                ~28     !4, 'cartItems'
   36    21        ADD_ARRAY_ELEMENT                                ~28     !6, 'origin'
   37    22        ADD_ARRAY_ELEMENT                                ~28     !7, 'destination'
   31    23        ADD_ARRAY_ELEMENT                                ~28     <false>, 'deliveredBySeller'
   39    24        ADD_ARRAY_ELEMENT                                ~28     !8, 'exemptCert'
   31    25        ASSIGN                                                   !10, ~28
   40    26        INIT_FCALL_BY_NAME                                       'curl_setopt_array'
         27        SEND_VAR_EX                                              !9
         28        FETCH_CONSTANT                                   ~30     'CURLOPT_POST'
         29        INIT_ARRAY                                       ~31     <true>, ~30
   41    30        FETCH_CONSTANT                                   ~32     'CURLOPT_RETURNTRANSFER'
   40    31        ADD_ARRAY_ELEMENT                                ~31     <true>, ~32
   42    32        FETCH_CONSTANT                                   ~33     'CURLOPT_SSL_VERIFYPEER'
   40    33        ADD_ARRAY_ELEMENT                                ~31     <false>, ~33
   43    34        FETCH_CONSTANT                                   ~34     'CURLOPT_HTTPHEADER'
   40    35        ADD_ARRAY_ELEMENT                                ~31     <array>, ~34
   45    36        FETCH_CONSTANT                                   ~35     'CURLOPT_POSTFIELDS'
         37        INIT_FCALL                                               'json_encode'
         38        SEND_VAR                                                 !10
         39        DO_ICALL                                         $36     
         40        ADD_ARRAY_ELEMENT                                ~31     $36, ~35
         41        SEND_VAL_EX                                              ~31
         42        DO_FCALL                                      0          
   46    43        INIT_FCALL_BY_NAME                                       'curl_exec'
         44        SEND_VAR_EX                                              !9
         45        DO_FCALL                                      0  $38     
         46        ASSIGN                                                   !11, $38
   48    47        INIT_FCALL                                               'json_decode'
         48        INIT_FCALL_BY_NAME                                       'curl_exec'
         49        SEND_VAR_EX                                              !9
         50        DO_FCALL                                      0  $40     
         51        SEND_VAR                                                 $40
         52        DO_ICALL                                         $41     
         53        ASSIGN                                                   !11, $41
   50    54        FETCH_OBJ_R                                      ~43     !11, 'ResponseType'
         55        IS_EQUAL                                                 ~43, 0
         56      > JMPZ                                                     ~44, ->69
   51    57    >   FETCH_OBJ_R                                      ~45     !11, 'Messages'
         58      > FE_RESET_R                                       $46     ~45, ->67
         59    > > FE_FETCH_R                                               $46, !12, ->67
   52    60    >   FETCH_OBJ_R                                      ~47     !12, 'ResponseType'
         61        CONCAT                                           ~48     '%3Cbr%3EError+%3A+', ~47
         62        CONCAT                                           ~49     ~48, '+-+'
         63        FETCH_OBJ_R                                      ~50     !12, 'Message'
         64        CONCAT                                           ~51     ~49, ~50
         65        ECHO                                                     ~51
   51    66      > JMP                                                      ->59
         67    >   FE_FREE                                                  $46
         68      > JMP                                                      ->80
   54    69    >   FETCH_OBJ_R                                      ~52     !11, 'CartItemsResponse'
         70      > FE_RESET_R                                       $53     ~52, ->79
         71    > > FE_FETCH_R                                               $53, !13, ->79
   55    72    >   FETCH_OBJ_R                                      ~54     !13, 'CartItemIndex'
         73        CONCAT                                           ~55     '%3Cbr%3ECart+Item+', ~54
         74        CONCAT                                           ~56     ~55, '+%3A+Tax+Amount%0A'
   56    75        FETCH_OBJ_R                                      ~57     !13, 'TaxAmount'
         76        CONCAT                                           ~58     ~56, ~57
         77        ECHO                                                     ~58
   54    78      > JMP                                                      ->71
         79    >   FE_FREE                                                  $53
   59    80    >   INIT_FCALL_BY_NAME                                       'curl_close'
         81        SEND_VAR_EX                                              !9
         82        DO_FCALL                                      0          
         83      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.63 ms | 1396 KiB | 17 Q