Skip to content

Xml2Array::convert($response)->toArray() not converting curl response correctly #4

Open
@PaiseHIM

Description

@PaiseHIM

Hi, I am trying to convert curl post request to an array.

Example Code:
$response = curl_exec($this->client);
$resArray = Xml2Array::convert($response)->toArray();

XML response from the curl call:

5601088 2024020621 20240206 163221 A N P 91206263877764 5 GROOM AV DISCOVERY FLORIDA 1709 GP GAUTENG 00000000000814603186 20191003 INDO JET CONWAY TRAVEL 20190820 WENDY KLAASSEN 416976700 06400

Array created by Xml2Array::convert($response)->toArray() :

Array ( [SOAP-ENV:Envelope] => Array ( [SOAP-ENV:Header] => [SOAP-ENV:Body] => Array ( [ns:submit-claim2caskResponse] => Array ( [reply] => 5601088 2024020621 20240206 163221 A N P 91206263877764 5 GROOM AV DISCOVERY FLORIDA 1709 GP GAUTENG 00000000000814603186 20191003 INDO JET CONWAY TRAVEL 20190820 WENDY KLAASSEN 416976700 06400 ) ) [@attributes] => Array ( [xmlns:SOAP-ENV] => http://schemas.xmlsoap.org/soap/envelope/ [xmlns:ns] => http://www.medikredit.co.za/CASK ) ) )

But if I pass the the top xml as static string to Xml2Array::convert($response)->toArray() it works correctly.

Array ( [MkFullXMLResponse] => Array ( [MkEligUninsuredXMLResponse] => Array ( [TransactionData] => Array ( [SupplierBHFNumber] => 5601088 [TransactionInfo] => Array ( [InternalClaimNumber] => 2024020657 [ProcessDate] => 20240206 [ProcessTime] => 113457 [TransactionResult] => A [SchemeResult] => N [PaymentAdvice] => P ) ) [HospitalData] => [VendorInfo] => [ProcessReference] => Array ( [MkRef] => 91205094438269 ) [AddressInformation] => Array ( [AddressLine1] => 5 GROOM AV [Suburb] => DISCOVERY [City] => FLORIDA [PostalCode] => 1709 [Province] => GP [ProvName] => GAUTENG ) [TelephoneNumberDetail] => Array ( [CellPhone] => 00000000000814603186 ) [EmployerDetails] => Array ( [0] => Array ( [LastRecordedDate] => 20191003 [EmployerName] => INDO JET CONWAY TRAVEL ) [1] => Array ( [LastRecordedDate] => 20190820 [EmployerName] => WENDY KLAASSEN ) ) [IncomeEstimator] => Array ( [ConsumerNumber] => 416976700 [PredictedIncome] => 06400 ) [Messaging] => ) [@attributes] => Array ( [xsi:schemaLocation] => http://www.medikredit.co.za/MedikreditElectronicClaimProcessing/xml4 C:/Users/RoshanW/ONEDRI1/Documents/IQPROJ1/ECDOH/XMLV40~1.XSD [xmlns] => http://www.medikredit.co.za/MedikreditElectronicClaimProcessing/xml4 ) ) )

Any help or guidance would be appreciate.

Derek

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions