troubleshooting Question

How to get variables out of an XML response to a curl post

Avatar of Richard Lloyd
Richard Lloyd asked on
PHPXML
4 Comments1 Solution86 ViewsLast Modified:
I need some advice on getting variables out of an XML response to a curl post.

The curl produces an xml response, eg:

<?xml version="1.0"?><ncresponse
orderID="TEST-21"
PAYID="304713xyz72"
PAYIDSUB="0"
NCSTATUS="0"
NCERROR="0"
ACCEPTANCE="test123"
STATUS="9"
IPCTY="99"
CCCTY="BE"
ECI="7"
CVCCheck="NO"
AAVCheck="NO"
VC="NO"
AAVZIP="NO"
AAVADDRESS="NO"
AAVNAME="NO"
AAVPHONE="NO"
AAVMAIL="NO"
amount="12.34"
currency="GBP"
PM="CreditCard"
BRAND="VISA"
TICKET="No Transaction found"
SUBBRAND="TEST"
ALIAS="010089D0-B4F9-876S-AA4E-14F807CB1889"
ECOM_BILLTO_POSTAL_CITY=""
ECOM_BILLTO_POSTAL_COUNTRYCODE=""
ECOM_BILLTO_POSTAL_STATEDESC=""
ECOM_BILLTO_POSTAL_STREET_LINE1=""
ECOM_BILLTO_POSTAL_STREET_LINE2=""
ECOM_BILLTO_POSTAL_POSTALCODE=""
CN="111"
ECOM_BILLTO_POSTAL_NAME_LAST=""
ECOM_BILLTO_POSTAL_NAME_FIRST="111"
ECOM_BILLTO_TELECOM_PHONE_NUMBER=""
ECOM_SHIPTO_POSTAL_CITY=""
ECOM_SHIPTO_POSTAL_COUNTRYCODE=""
ECOM_SHIPTO_POSTAL_STATEDESC=""
ECOM_SHIPTO_POSTAL_STREET_LINE1=""
ECOM_SHIPTO_POSTAL_STREET_LINE2=""
ECOM_SHIPTO_POSTAL_POSTALCODE=""
ECOM_SHIPTO_POSTAL_NAME_LAST="111"
NCERRORPLUS="!"
BIN="411111">
</ncresponse>

How do I extract each of the variables to use for further processing with PHP
ASKER CERTIFIED SOLUTION
Richard Lloyd

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros