3v4l.org

run code in 300+ PHP versions simultaneously
<?php // used namespaces, the keys do NOT need to match the prefixes in the XML. $xmlns = [ 'soap' => 'http://schemas.xmlsoap.org/soap/envelope/', 'eb' => 'http://www.ebxml.org/namespaces/messageHeader', 'sec' => 'http://schemas.xmlsoap.org/ws/2002/12/secext' ]; $document = new DOMDocument(); $document->loadXML(getSoapXmlString()); $xpath = new DOMXpath($document); // register your aliases for the namespaces foreach ($xmlns as $alias => $uri) { $xpath->registerNamespace($alias, $uri); } $token = $xpath->evaluate( 'string(//sec:Security/sec:BinarySecurityToken)' ); var_dump($token); function getSoapXmlString() { return <<<'XML' <?xml version="1.0" encoding="UTF-8"?> <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"> <soap-env:Header> <eb:MessageHeader xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" eb:version="1.0" soap-env:mustUnderstand="1"> <eb:From> <eb:PartyId eb:type="URI">Sabre_API</eb:PartyId> </eb:From> <eb:To> <eb:PartyId eb:type="URI">Agency</eb:PartyId> </eb:To> <eb:ConversationId>2021.01.DevStudio</eb:ConversationId> <eb:Service eb:type="sabreXML">Session</eb:Service> <eb:Action>TokenCreateRS</eb:Action> <eb:MessageData> <eb:MessageId>1913771794839350290</eb:MessageId> <eb:Timestamp>2023-02-23T22:04:43</eb:Timestamp> </eb:MessageData> </eb:MessageHeader> <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2002/12/secext"> <wsse:BinarySecurityToken valueType="String" EncodingType="wsse:Base64Binary">T1RLAQLASo74A7olKG7QnepeFqs19UHX+0Cds9QiDZoYfu677xC3Vkr9a+OcQhutjPL4atVMAADQRtHIXdehGg/0OVuPdia/0cM233jFDvyJJHgJHC3o8gV2ssS63b4Y0lgCG59SiG4tmEcqAXcYAMlnq+wJ4TfsOIDFwYdP+D0peSEFBM/m3EyOUqc4idJ+vO4S7xENCeQ7UX4YVKjVLJs788omPDbSIRNo85KQ5QxRprldV0jucJpAtbNfs1DrMHFqNIPyg0CpVpgXILkFx0azkcAuvmbHMHLqqO13WJEOhsG0KDBhBhRn8CwoCgD9foXL24W6yGu8Ecm0Fzvb/MuAjuYm9s48yg**</wsse:BinarySecurityToken> </wsse:Security> </soap-env:Header> <soap-env:Body> <sws:TokenCreateRS xmlns:sws="http://webservices.sabre.com" Version="1.0.0"> <sws:Success/> </sws:TokenCreateRS> </soap-env:Body> </soap-env:Envelope> XML; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 21
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 21
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/2CLIk
function name:  (null)
number of ops:  30
compiled vars:  !0 = $xmlns, !1 = $document, !2 = $xpath, !3 = $uri, !4 = $alias, !5 = $token
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                   !0, <array>
   10     1        NEW                                              $7      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $7
   11     4        INIT_METHOD_CALL                                         !1, 'loadXML'
          5        INIT_FCALL_BY_NAME                                       'getSoapXmlString'
          6        DO_FCALL                                      0  $10     
          7        SEND_VAR_NO_REF_EX                                       $10
          8        DO_FCALL                                      0          
   12     9        NEW                                              $12     'DOMXpath'
         10        SEND_VAR_EX                                              !1
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !2, $12
   14    13      > FE_RESET_R                                       $15     !0, ->21
         14    > > FE_FETCH_R                                       ~16     $15, !3, ->21
         15    >   ASSIGN                                                   !4, ~16
   15    16        INIT_METHOD_CALL                                         !2, 'registerNamespace'
         17        SEND_VAR_EX                                              !4
         18        SEND_VAR_EX                                              !3
         19        DO_FCALL                                      0          
   14    20      > JMP                                                      ->14
         21    >   FE_FREE                                                  $15
   18    22        INIT_METHOD_CALL                                         !2, 'evaluate'
   19    23        SEND_VAL_EX                                              'string%28%2F%2Fsec%3ASecurity%2Fsec%3ABinarySecurityToken%29'
   18    24        DO_FCALL                                      0  $19     
         25        ASSIGN                                                   !5, $19
   22    26        INIT_FCALL                                               'var_dump'
         27        SEND_VAR                                                 !5
         28        DO_ICALL                                                 
   55    29      > RETURN                                                   1

Function getsoapxmlstring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2CLIk
function name:  getSoapXmlString
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E > > RETURN                                                   '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E+%0A%3Csoap-env%3AEnvelope+xmlns%3Asoap-env%3D%22http%3A%2F%2Fschemas.xmlsoap.org%2Fsoap%2Fenvelope%2F%22%3E%0A++++%3Csoap-env%3AHeader%3E%0A++++++++%3Ceb%3AMessageHeader+xmlns%3Aeb%3D%22http%3A%2F%2Fwww.ebxml.org%2Fnamespaces%2FmessageHeader%22+eb%3Aversion%3D%221.0%22+soap-env%3AmustUnderstand%3D%221%22%3E%0A++++++++++++%3Ceb%3AFrom%3E%0A++++++++++++++++%3Ceb%3APartyId+eb%3Atype%3D%22URI%22%3ESabre_API%3C%2Feb%3APartyId%3E%0A++++++++++++%3C%2Feb%3AFrom%3E%0A++++++++++++%3Ceb%3ATo%3E%0A++++++++++++++++%3Ceb%3APartyId+eb%3Atype%3D%22URI%22%3EAgency%3C%2Feb%3APartyId%3E%0A++++++++++++%3C%2Feb%3ATo%3E%0A++++++++++++%3Ceb%3AConversationId%3E2021.01.DevStudio%3C%2Feb%3AConversationId%3E%0A++++++++++++%3Ceb%3AService+eb%3Atype%3D%22sabreXML%22%3ESession%3C%2Feb%3AService%3E%0A++++++++++++%3Ceb%3AAction%3ETokenCreateRS%3C%2Feb%3AAction%3E%0A++++++++++++%3Ceb%3AMessageData%3E%0A++++++++++++++++%3Ceb%3AMessageId%3E1913771794839350290%3C%2Feb%3AMessageId%3E%0A++++++++++++++++%3Ceb%3ATimestamp%3E2023-02-23T22%3A04%3A43%3C%2Feb%3ATimestamp%3E%0A++++++++++++%3C%2Feb%3AMessageData%3E%0A++++++++%3C%2Feb%3AMessageHeader%3E%0A++++++++%3Cwsse%3ASecurity+xmlns%3Awsse%3D%22http%3A%2F%2Fschemas.xmlsoap.org%2Fws%2F2002%2F12%2Fsecext%22%3E%0A++++++++++++%3Cwsse%3ABinarySecurityToken+valueType%3D%22String%22+EncodingType%3D%22wsse%3ABase64Binary%22%3ET1RLAQLASo74A7olKG7QnepeFqs19UHX%2B0Cds9QiDZoYfu677xC3Vkr9a%2BOcQhutjPL4atVMAADQRtHIXdehGg%2F0OVuPdia%2F0cM233jFDvyJJHgJHC3o8gV2ssS63b4Y0lgCG59SiG4tmEcqAXcYAMlnq%2BwJ4TfsOIDFwYdP%2BD0peSEFBM%2Fm3EyOUqc4idJ%2BvO4S7xENCeQ7UX4YVKjVLJs788omPDbSIRNo85KQ5QxRprldV0jucJpAtbNfs1DrMHFqNIPyg0CpVpgXILkFx0azkcAuvmbHMHLqqO13WJEOhsG0KDBhBhRn8CwoCgD9foXL24W6yGu8Ecm0Fzvb%2FMuAjuYm9s48yg%2A%2A%3C%2Fwsse%3ABinarySecurityToken%3E%0A++++++++%3C%2Fwsse%3ASecurity%3E%0A++++%3C%2Fsoap-env%3AHeader%3E%0A++++%3Csoap-env%3ABody%3E%0A++++++++%3Csws%3ATokenCreateRS+xmlns%3Asws%3D%22http%3A%2F%2Fwebservices.sabre.com%22+Version%3D%221.0.0%22%3E%0A++++++++++++%3Csws%3ASuccess%2F%3E%0A++++++++%3C%2Fsws%3ATokenCreateRS%3E%0A++++%3C%2Fsoap-env%3ABody%3E+%3C%2Fsoap-env%3AEnvelope%3E%0A'
   55     1*     > RETURN                                                   null

End of function getsoapxmlstring

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.51 ms | 1010 KiB | 14 Q