I have huge problems getting the values from the xml document from an url. I want to read / parse the xml document I receive when sending an url to a site, and goo through it to check for errors, as I want to inform the user if the sms message was sent or not. And I want to use the result to look up what users it failed to send to.
// The idea is that I send mass-sms messages to a service provider, and receives an xml in return after sending the url to the browser. If all going well, the xml structure will be like below:
<?xml version="1.0"?>
<SMS_INTERNETT version="2.0">
<RESPONSE processed="OK">
<BASIC_DATA sender="99999999" billedNumber="5533455" sId="10000000"/>
<RECIPIENT status="OK" address="+4700000000"/>
<RECIPIENT status="OK" address="+4700000001"/>
</RESPONSE>
</SMS_INTERNETT>
// If it has not gone ok, the xml code than is sent in return might look like below:
<?xml version="1.0" ?>
- <SMS_INTERNETT version="2.0">
- <RESPONSE processed="OK">
<BASIC_DATA sender="99999999" billedNumber="742356487" sId="10000000" />
<RECIPIENT status="OK" address="+470000000" />
- <RECIPIENT status="FAILED" address="0000000">
<ERROR code="8000">Tried to send but failed.</ERROR>
</RECIPIENT>
</RESPONSE>
</SMS_INTERNETT>
I have tried with a lot of code examples from different sites. I am a newbie, and not able to understand all the code I have tried to use.
Does anyone know how to get the information above into an php array for me to continue to work with?
The fields (info) I need from the above xml documents are:
Recipient status and address.
So if I had it in an array like:
$recipients and $address I can work with it.
Can anyone help me with this problem, and perhaps help me write the code. I would be foreever thankful.
I know it is kind of rude to ask someone write me code, but I have tried for about three weeks to get it right. And if I post all the code I have tried, it would perhaps fill the forum alone 🙂
In order to understand it, what happends and so on: I believe I need code with comments.
If anyone can help, please do so, as I am desperate 🙂
Thanks.