I am having a problem parsing XML that is returned from a website that I use CURL to POST to. The value I am getting returned is a single character - STATUSCODE (1). The XML at website looks like:
<?xml version="1.0" encoding="" ?>
<TRUMPIA>
<STATUSCODE>1</STATUSCODE>
<MESSAGE>
<![CDATA[Query Success]]>
</MESSAGE>
<MEMBERCODE>
<![CDATA[12341234123412341234123412341234]]>
</MEMBERCODE>
<MEMBERDATA>
<FIRSTNAME>
<![CDATA[FIRST_NAME]]>
</FIRSTNAME>
<LASTNAME>
<![CDATA[LAST_NAME]]>
</LASTNAME>
<TOOLS>
<EMAIL VERIFY="1">
<![CDATA[email@email.com]]>
</EMAIL>
<MOBILEPHONE VERIFY="0">
<![CDATA[123123132123]]>
</MOBILEPHONE>
</TOOLS>
</MEMBERDATA>
</TRUMPIA>
If I send form to website it returns all data in string.
Here is the code that I have tried:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$path);
curl_setopt($ch, CURLOPT_FAILONERROR,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,"APIKEY=$apikey&ContactID=$contactid");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
$retValue = curl_exec($ch);
echo $retValue;
curl_close($ch);
return $retValue;
Need to be able to access each individual field. Please help
<?xml version="1.0" encoding="" ?>
<TRUMPIA>
<STATUSCODE>1</STATUSCODE>
<MESSAGE>
<![CDATA[Query Success]]>
</MESSAGE>
<MEMBERCODE>
<![CDATA[12341234123412341234123412341234]]>
</MEMBERCODE>
<MEMBERDATA>
<FIRSTNAME>
<![CDATA[FIRST_NAME]]>
</FIRSTNAME>
<LASTNAME>
<![CDATA[LAST_NAME]]>
</LASTNAME>
<TOOLS>
<EMAIL VERIFY="1">
<![CDATA[email@email.com]]>
</EMAIL>
<MOBILEPHONE VERIFY="0">
<![CDATA[123123132123]]>
</MOBILEPHONE>
</TOOLS>
</MEMBERDATA>
</TRUMPIA>
If I send form to website it returns all data in string.
Here is the code that I have tried:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$path);
curl_setopt($ch, CURLOPT_FAILONERROR,1);
curl_setopt($ch,CURLOPT_POSTFIELDS,"APIKEY=$apikey&ContactID=$contactid");
curl_setopt($ch, CURLOPT_FOLLOWLOCATION,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, 15);
$retValue = curl_exec($ch);
echo $retValue;
curl_close($ch);
return $retValue;
Need to be able to access each individual field. Please help