3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* * Some little $_POST values and $apiKey are already set. */ $_POST['datepicker1'] = '2013-06-12'; $_POST['datepicker2'] = '2013-06-16'; $apiKey = '.....'; $destination = 'napoli'; $adults = '2'; /* * Create the XML for the request with hepl of SimpleXML */ $url = "https://api.eancdn.com/ean-services/rs/hotel/v3/list"; $xml = new SimpleXMLElement('<HotelListRequest/>'); $xml->destinationString = $destination; $xml->arrivalDate = $_POST['datepicker1']; $xml->departureDate = $_POST['datepicker2']; $xml->RoomGroup->Room->numberOfAdults = $adults; /* * Set the parameters for the API request */ $params = [ 'cid' => 55505, 'minorRev' => 99, 'apiKey' => $apiKey, 'locale' => 'it_IT', 'currencyCode' => 'EUR', 'xml' => $xml->asXML(), ]; /* * Set the stream context for the API request */ $context = stream_context_create(['http' => [ 'method' => 'POST', 'header' => [ 'Accept: application/xml', 'Content-Type: application/x-www-form-urlencoded', ], 'content' => http_build_query($params), ]]); libxml_set_streams_context($context); /* * Perform the API request (and here: insert the stylesheet PI) */ $hotel = simplexml_load_file($url, 'MySimpleXMLElement'); $hotel->addProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="css/stile.xsl"'); $hotel->asXML('php://output'); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p7o7r
function name:  (null)
number of ops:  64
compiled vars:  !0 = $apiKey, !1 = $destination, !2 = $adults, !3 = $url, !4 = $xml, !5 = $params, !6 = $context, !7 = $hotel
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FETCH_W                      global              $8      '_POST'
          1        ASSIGN_DIM                                               $8, 'datepicker1'
          2        OP_DATA                                                  '2013-06-12'
    6     3        FETCH_W                      global              $10     '_POST'
          4        ASSIGN_DIM                                               $10, 'datepicker2'
          5        OP_DATA                                                  '2013-06-16'
    8     6        ASSIGN                                                   !0, '.....'
   10     7        ASSIGN                                                   !1, 'napoli'
   11     8        ASSIGN                                                   !2, '2'
   16     9        ASSIGN                                                   !3, 'https%3A%2F%2Fapi.eancdn.com%2Fean-services%2Frs%2Fhotel%2Fv3%2Flist'
   18    10        NEW                                              $16     'SimpleXMLElement'
         11        SEND_VAL_EX                                              '%3CHotelListRequest%2F%3E'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !4, $16
   19    14        ASSIGN_OBJ                                               !4, 'destinationString'
         15        OP_DATA                                                  !1
   20    16        FETCH_R                      global              ~21     '_POST'
         17        FETCH_DIM_R                                      ~22     ~21, 'datepicker1'
         18        ASSIGN_OBJ                                               !4, 'arrivalDate'
         19        OP_DATA                                                  ~22
   21    20        FETCH_R                      global              ~24     '_POST'
         21        FETCH_DIM_R                                      ~25     ~24, 'datepicker2'
         22        ASSIGN_OBJ                                               !4, 'departureDate'
         23        OP_DATA                                                  ~25
   22    24        FETCH_OBJ_W                                      $26     !4, 'RoomGroup'
         25        FETCH_OBJ_W                                      $27     $26, 'Room'
         26        ASSIGN_OBJ                                               $27, 'numberOfAdults'
         27        OP_DATA                                                  !2
   28    28        INIT_ARRAY                                       ~29     55505, 'cid'
   29    29        ADD_ARRAY_ELEMENT                                ~29     99, 'minorRev'
   30    30        ADD_ARRAY_ELEMENT                                ~29     !0, 'apiKey'
   31    31        ADD_ARRAY_ELEMENT                                ~29     'it_IT', 'locale'
   32    32        ADD_ARRAY_ELEMENT                                ~29     'EUR', 'currencyCode'
   33    33        INIT_METHOD_CALL                                         !4, 'asXML'
         34        DO_FCALL                                      0  $30     
         35        ADD_ARRAY_ELEMENT                                ~29     $30, 'xml'
   27    36        ASSIGN                                                   !5, ~29
   39    37        INIT_FCALL                                               'stream_context_create'
   40    38        INIT_ARRAY                                       ~32     'POST', 'method'
         39        ADD_ARRAY_ELEMENT                                ~32     <array>, 'header'
   45    40        INIT_FCALL                                               'http_build_query'
         41        SEND_VAR                                                 !5
         42        DO_ICALL                                         $33     
         43        ADD_ARRAY_ELEMENT                                ~32     $33, 'content'
         44        INIT_ARRAY                                       ~34     ~32, 'http'
         45        SEND_VAL                                                 ~34
         46        DO_ICALL                                         $35     
   39    47        ASSIGN                                                   !6, $35
   47    48        INIT_FCALL                                               'libxml_set_streams_context'
         49        SEND_VAR                                                 !6
         50        DO_ICALL                                                 
   53    51        INIT_FCALL                                               'simplexml_load_file'
         52        SEND_VAR                                                 !3
         53        SEND_VAL                                                 'MySimpleXMLElement'
         54        DO_ICALL                                         $38     
         55        ASSIGN                                                   !7, $38
   54    56        INIT_METHOD_CALL                                         !7, 'addProcessingInstruction'
         57        SEND_VAL_EX                                              'xml-stylesheet'
         58        SEND_VAL_EX                                              'type%3D%22text%2Fxsl%22+href%3D%22css%2Fstile.xsl%22'
         59        DO_FCALL                                      0          
   55    60        INIT_METHOD_CALL                                         !7, 'asXML'
         61        SEND_VAL_EX                                              'php%3A%2F%2Foutput'
         62        DO_FCALL                                      0          
   56    63      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.79 ms | 1400 KiB | 21 Q