SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Sep 2008
    Posts
    341
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Complicated http://php.net/manual/en/function.xml-parse-into-struct.php

    I am trying to use this: http://php.net/manual/en/function.xm...nto-struct.php to parse this:

    [code]
    <?xml version="1.0" encoding="utf-8"?>
    <PaymentNotification xmlns="http://">
    <PaymentMethod>card</PaymentMethod>
    <Hash>12345KKLS</Hash>
    <Payments>
    <Payment>
    <PaymentID>709750ba-b9b6-44c4-9812</PaymentID>
    <Amount>70</Amount>
    <Currency>USD</Currency>
    <Date>2011-05-11T07:41:44.957</Date>
    <StatusID>4</StatusID>
    </Payment>
    <Payment>
    <PaymentID>e0c66bae-c423-43c6-b896</PaymentID>
    <Amount>50</Amount>
    <Currency>USD</Currency>
    <Date>2011-05-11T07:42:13.55</Date>
    <StatusID>2</StatusID>
    </Payment>
    </Payments>
    </PaymentNotification>
    [code]

    ...but can't work out which numbers to use. I only need to grab the payment ID where the statusID is 4 (for each one as could be 1 or more per xml message).

    It's very complicated http://php.net/manual/en/function.xml-parse-into-struct.php

  2. #2
    @php.net Salathe's Avatar
    Join Date
    Dec 2004
    Location
    Edinburgh
    Posts
    1,397
    Mentioned
    63 Post(s)
    Tagged
    0 Thread(s)
    Do you absolutely need to use that function? It's a pretty ancient and convoluted way of accessing XML in PHP.
    Salathe
    Software Developer and PHP Manual Author.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •