Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6056325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:21:49+00:00 2026-05-23T08:21:49+00:00

I have some XML that is being returned to be as an object, like

  • 0

I have some XML that is being returned to be as an object, like this:

SwitchvoxResponse Object
(
[apiStatus:private] => success
[apiErrors:private] => Array
    (
    )

[apiResult:private] => Array
    (
        [calls] => Array
            (
                [page_number] => 1
                [total_pages] => 1
                [items_per_page] => 50
                [total_items] => 1
                [call] => Array
                    (
                        [0] => Array
                            (
                                [id] => 14301
                                [origination] => outgoing
                                [start_time] => 2011-06-17 13:40:58
                                [from] => CALLER_NAME <4485>
                                [from_account_id] => 1120
                                [from_name] => CALLER_NAME
                                [from_number] => 4485
                                [to] => CALLEE_NAME <6534>
                                [to_account_id] => 1101
                                [to_name] => CALLEE_NAME
                                [to_number] => 6534
                                [total_duration] => 47
                                [talk_duration] => 43
                                [events] => Array
                                    (
                                        [event] => Array
                                            (
                                                [0] => Array
                                                    (
                                                        [start_time] => 2011-06-17 13:40:58
                                                        [type] => OUTGOING
                                                        [display] => Dialed number (6534)
                                                    )

                                                [1] => Array
                                                    (
                                                        [start_time] => 2011-06-17 13:40:58
                                                        [type] => INTERNAL
                                                        [display] => Rang CALLEE_NAME <6534>
                                                    )

                                                [2] => Array
                                                    (
                                                        [start_time] => 2011-06-17 13:41:02
                                                        [type] => TALKING
                                                        [display] => Talked to CALLEE_NAME <6534> for 43 seconds
                                                    )

                                                [3] => Array
                                                    (
                                                        [start_time] => 2011-06-17 13:41:45
                                                        [type] => HANGUP
                                                        [display] => Call was hung up by CALLER_NAME <4485>
                                                    )

                                            )

                                    )

                            )
                    )
            )
    )
)

How do I pull out the values of these variables?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:21:50+00:00Added an answer on May 23, 2026 at 8:21 am

    The results can be accessed via the SwitchvoxResponse::getResult() method. Given $object is the SwitchvoxResponse object quoted in the question, the example below loops over each call and prints the from values.

    $result = $object->getResult();
    foreach ($result['calls']['call'] as $call) {
        echo $call['from'];
    }
    

    Similarly, the response status is fetched via $object->getResponseStatus() and any errors via $object->getErrors().

    The response statuses can be one of SV_RESPONSE_SUCCESS, SV_RESPONSE_FAULT or SV_RESPONSE_FAILED.


    Edit re. comments

    To get the items for the first call only, simply do:

    $result = $object->getResult();
    $call = $result['calls']['call'][0];
    // And access the values like
    echo $call['from_name']; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function that loads in some XML that looks like this: private
I have some XML code that looks like this <SEARCHRESULTS> <FUNCTION name=BarGraph> <PARAMETER name=numList></PARAMETER>
Grettings! I have some XML that looks like this: <Root> <SectionA> <Item id=111> <Options>
I have some xml that looks like this: <rootElement attribute=' > '/> This is
I have an XML file that I would like to map some attributes of
I have an XML file that I'm trying to serialize into an object. Some
I have an xml being returned by an extension method. Can some please help
I have some xml being returned in sharepoint, Im using xslt to create the
I have some (untyped) XML being stored in SQL Server 2005 that I need
I am working with some XML that holds strings like: <node>This is a string</node>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.