<?php
$xml = '<Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><Body><Response TID="c4ed40a4-8e91-46ee-b571-9ace4c47f642" xmlns:ns="http://wsg.avis.com/wsbang"><OTA_VehResRS xsi:schemaLocation="http://www.opentravel.org/OTA/2008/05 OTA_VehResRS" EchoToken="CT" Target="Production" Version="1.0" SequenceNmbr="0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opentravel.org/OTA/2003/05"><Success/><VehResRSCore><VehReservation><VehSegmentCore><Vendor>Budget</Vendor></VehSegmentCore></VehReservation></VehResRSCore><Errors><Error Type="3" ShortText="30212 BizRule">Invalid Value for payment amount</Error></Errors></OTA_VehResRS><!-- Processed by Direct Connect ver. 12.0 build 0 --></Response></Body></Envelope>';
$objXml = simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_NOCDATA);
$rootelement = $objXml->getName();
$hello[$rootelement] = json_decode(json_encode($objXml), TRUE);
var_dump($hello);
- Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16, 7.3.18 - 7.3.33, 7.4.0 - 7.4.4, 7.4.6 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
- array(1) {
["Envelope"]=>
array(1) {
["Body"]=>
array(1) {
["Response"]=>
array(3) {
["@attributes"]=>
array(1) {
["TID"]=>
string(36) "c4ed40a4-8e91-46ee-b571-9ace4c47f642"
}
["OTA_VehResRS"]=>
array(4) {
["@attributes"]=>
array(4) {
["EchoToken"]=>
string(2) "CT"
["Target"]=>
string(10) "Production"
["Version"]=>
string(3) "1.0"
["SequenceNmbr"]=>
string(1) "0"
}
["Success"]=>
array(0) {
}
["VehResRSCore"]=>
array(1) {
["VehReservation"]=>
array(1) {
["VehSegmentCore"]=>
array(1) {
["Vendor"]=>
string(6) "Budget"
}
}
}
["Errors"]=>
array(1) {
["Error"]=>
string(32) "Invalid Value for payment amount"
}
}
["comment"]=>
array(0) {
}
}
}
}
}
- Output for 8.3.5
- Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
array(1) {
["Envelope"]=>
array(1) {
["Body"]=>
array(1) {
["Response"]=>
array(3) {
["@attributes"]=>
array(1) {
["TID"]=>
string(36) "c4ed40a4-8e91-46ee-b571-9ace4c47f642"
}
["OTA_VehResRS"]=>
array(4) {
["@attributes"]=>
array(4) {
["EchoToken"]=>
string(2) "CT"
["Target"]=>
string(10) "Production"
["Version"]=>
string(3) "1.0"
["SequenceNmbr"]=>
string(1) "0"
}
["Success"]=>
array(0) {
}
["VehResRSCore"]=>
array(1) {
["VehReservation"]=>
array(1) {
["VehSegmentCore"]=>
array(1) {
["Vendor"]=>
string(6) "Budget"
}
}
}
["Errors"]=>
array(1) {
["Error"]=>
string(32) "Invalid Value for payment amount"
}
}
["comment"]=>
array(0) {
}
}
}
}
}
- Output for 7.3.17, 7.4.5
- array(1) {
["Envelope"]=>
array(1) {
["Body"]=>
array(1) {
["Response"]=>
array(3) {
["@attributes"]=>
array(1) {
["TID"]=>
string(36) "c4ed40a4-8e91-46ee-b571-9ace4c47f642"
}
["OTA_VehResRS"]=>
array(4) {
["@attributes"]=>
array(4) {
["EchoToken"]=>
string(2) "CT"
["Target"]=>
string(10) "Production"
["Version"]=>
string(3) "1.0"
["SequenceNmbr"]=>
string(1) "0"
}
["Success"]=>
array(0) {
}
["VehResRSCore"]=>
array(1) {
["VehReservation"]=>
array(1) {
["VehSegmentCore"]=>
array(1) {
["Vendor"]=>
string(6) "Budget"
}
}
}
["Errors"]=>
array(1) {
["Error"]=>
array(2) {
["@attributes"]=>
array(2) {
["Type"]=>
string(1) "3"
["ShortText"]=>
string(13) "30212 BizRule"
}
[0]=>
string(32) "Invalid Value for payment amount"
}
}
}
["comment"]=>
array(0) {
}
}
}
}
}
preferences:
147.36 ms | 404 KiB | 155 Q