Read XML PHP

stsights

New Member
Messages
159
Reaction score
0
Points
0
Hi.
Does any one has a php sintax to parse and read the contents of this xml string, like example to extract the text of message id, sendtdate, donedate, status??
This is the xml structure.

<deliveryreport>
<message id="msgID" sentdate="xxxxx" donedate="xxxxx" status="xxxxxx" />

</deliveryreport>

My trouble is that this structure is not the same that I read before with php so if you could help me with some script thank you
Regards
 

OdieusG

New Member
Messages
50
Reaction score
0
Points
0
Ajax, to my knowledge can do this also, and doesn't need to utilize any PHP code.....
 

stsights

New Member
Messages
159
Reaction score
0
Points
0
Thank you for the response that was what I need.
I have another question guys, I receive this help from my support but I dont understand how receive the xml data that they say
This is the email.

You can receive the reports on Your url with the PUSH method .
You need to setup Your system to read the received reports,

In the PUSH method we send You the reports with the structure explained below.

The format of the XML delivery report structure will be:

<deliveryreport>
<message id="msgID" sentdate="xxxxx" donedate="xxxxx"
status="xxxxxx" />
.....
</deliveryreport>


Delivery report example:

<DeliveryReport><message id="1023012301" sentdate=""
donedate="2005/7/19 22:0:0" status="NOT_SENT" /></DeliveryReport>

But what I dont understand what I can catch that structure that they send me because normally I get the data via post or get but this with puch method I dont know how please help me with this and thank you for your answer.
 

garrettroyce

Community Support
Community Support
Messages
5,609
Reaction score
251
Points
63
I would avoid having to do this and I don't understand why the software you're using is requiring you to do so, but here's how to do it.

You'll have to have a copy of the file saved. If your software is outputting this file directly, there's no way to have php escape all the special chars in an XML file. You'll have to import it using SimpleXML then use the function I mentioned above to extract the data. Then you can use mail() to send it to yourself. You'll have to set CRON up to run your php script every so often to check the XML logs.
 

stsights

New Member
Messages
159
Reaction score
0
Points
0
I undestand now, my software is that I send sms with a provider then this provider sends me the status of the sms via xml push but in my logs appears the url of my sms provider that it sent me or visited my update page but I do not know how to capture the structure that my sms provider sends me, what you say is another way to collect the structure but what I dont understand is about xml push I mean where is the structure that is sent to my page, because I dont know how to catch it. or there is no way to catch a xml push with php??
Edit:
garrettroyce could I sent you a pdf file that is the manual of my sms service provider just for that you see what I mean with the delivery reports to my page??
 
Last edited:

stsights

New Member
Messages
159
Reaction score
0
Points
0
Hello!!!
I just find out how to do that any way thank you garrettroyce for your answers and everybody for your help, but this is how I resolve it to receive the xml data with this code.
$HTTP_RAW_POST_DATA = file_get_contents ('php://input') or die('file_get_contents (php://input)');

Thank you againg
 
Top