+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Read XML PHP

  1. #1
    stsights is offline x10 Sophmore stsights is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    159

    Question Read XML PHP

    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

  2. #2
    garrettroyce's Avatar
    garrettroyce is offline Generally Helpful Member garrettroyce is a glorious beacon of lightgarrettroyce is a glorious beacon of light
    Join Date
    Apr 2008
    Location
    IL, USA
    Posts
    3,746

    Re: Read XML PHP

    SimpleXML is built in to php and should be what you want:

    http://www.php.net/manual/en/functio...attributes.php
    gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer

  3. #3
    OdieusG is offline x10Hosting Member OdieusG is an unknown quantity at this point
    Join Date
    Jan 2009
    Location
    Bangor, Maine
    Posts
    50

    Re: Read XML PHP

    Ajax, to my knowledge can do this also, and doesn't need to utilize any PHP code.....

  4. #4
    stsights is offline x10 Sophmore stsights is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    159

    Re: Read XML PHP

    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.

  5. #5
    garrettroyce's Avatar
    garrettroyce is offline Generally Helpful Member garrettroyce is a glorious beacon of lightgarrettroyce is a glorious beacon of light
    Join Date
    Apr 2008
    Location
    IL, USA
    Posts
    3,746

    Re: Read XML PHP

    Here's what they are talking about:

    http://www.codeguru.com/csharp/.net/...cle.php/c13253
    gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer

  6. #6
    stsights is offline x10 Sophmore stsights is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    159

    Re: Read XML PHP

    Do you know how to do this in php?? to receive the xml structure?

  7. #7
    garrettroyce's Avatar
    garrettroyce is offline Generally Helpful Member garrettroyce is a glorious beacon of lightgarrettroyce is a glorious beacon of light
    Join Date
    Apr 2008
    Location
    IL, USA
    Posts
    3,746

    Re: Read XML PHP

    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.
    gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer

  8. #8
    stsights is offline x10 Sophmore stsights is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    159

    Re: Read XML PHP

    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 by stsights; 05-11-2009 at 10:19 AM. Reason: Automerged Doublepost

  9. #9
    garrettroyce's Avatar
    garrettroyce is offline Generally Helpful Member garrettroyce is a glorious beacon of lightgarrettroyce is a glorious beacon of light
    Join Date
    Apr 2008
    Location
    IL, USA
    Posts
    3,746

    Re: Read XML PHP

    Yeah, go ahead.
    gjr.gr - coming soon: secrets of OCD coding from a self taught tinkerer

  10. #10
    stsights is offline x10 Sophmore stsights is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    159

    Re: Read XML PHP

    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

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Ever Been Suspended For Using PHP?
    By dragoneye_xp in forum Off Topic
    Replies: 26
    Last Post: 08-16-2009, 07:17 PM
  2. Read this if your PHP version has been downgraded!
    By garrettroyce in forum Free Hosting
    Replies: 0
    Last Post: 02-25-2009, 06:44 AM
  3. [PHP] Variables in PHP
    By Bryon in forum Tutorials
    Replies: 15
    Last Post: 01-29-2009, 09:46 AM
  4. "PHP Startup: Invalid Library" - Interesting error
    By javaguy78 in forum Free Hosting
    Replies: 5
    Last Post: 03-27-2007, 02:33 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers