Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
PaiseHIM opened this issue Feb 6, 2024 · 0 comments

Comments

@PaiseHIM
Copy link

PaiseHIM commented Feb 6, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant