I need to get the data out of an XML response./

Hi,  Thankyou experts for helping out!

i am submitting some data to an API.

I get back the below packet:
object(stdClass)#4 (7) {
  ["nextpageuri"]=>
  NULL
  ["previouspageuri"]=>
  NULL
  ["sms_messages"]=>
  array(1) {
    [0]=>
    object(stdClass)#5 (7) {
      ["created"]=>
      string(31) "Tue, 13 Mar 2018 00:02:15 +0000"
      ["id"]=>
      string(32) "406e3658b6c0c0984dacee9298b0c5d8"
      ["from"]=>
      string(10) "0419697XXX"
      ["destination"]=>
      string(11) "61402374XXX"
      ["message"]=>
      string(86) "Hi Jimmy, Broken SMS begun."
      ["uri"]=>
      string(48) "/2016-11-30/sms/406e3658b6c0c0984dacee9298b0c5d8"
      ["receipts"]=>
      object(stdClass)#6 (1) {
        ["delivered"]=>
        string(31) "Tue, 13 Mar 2018 00:02:25 +0000"
      }
    }
  }
  ["message"]=>
  string(16) "Response follows"
  ["api_version"]=>
  string(10) "2016-11-30"
  ["status"]=>
  int(200)
  ["uri"]=>
  string(48) "/2016-11-30/sms/406e3658b6c0c0984dacee9298b0c5d8"
}

Open in new window


Could someone please help me serialise it?

I want to gain access to this part:
      ["receipts"]=>
      object(stdClass)#6 (1) {
        ["delivered"]=>
        string(31) "Tue, 13 Mar 2018 00:02:25 +0000"
      }

Open in new window


Basically I want whatever is in the section "Delivered".

Could someone please help?
mavmanauNetwork Engineer/SysadminAsked:
Who is Participating?
 
Steve BinkConnect With a Mentor Commented:
What you posted above...  Are you receiving that as a string, or are you receiving the object, and posting the export of that object here?

If you're receiving the object, then it is a simple matter of tracing the properties down.  For example, if you receive that object into a variable called "my_var", then you can access the "Delivered" property with:
$my_var->sms_messages[0]->receipts->delivered

Open in new window

2
 
mavmanauNetwork Engineer/SysadminAuthor Commented:
many thanks - you were of great assistance!!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.