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 7025025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:55:12+00:00 2026-05-27T23:55:12+00:00

I am trying to use an API that returns the following structure <TwilioResponse> <Call>

  • 0

I am trying to use an API that returns the following structure

    <TwilioResponse>
     <Call>
     <Sid>CAe1644a7eed5088b159577c5802d8be38</Sid>
     <DateCreated>Tue, 10 Aug 2010 08:02:17 +0000</DateCreated>
     <DateUpdated>Tue, 10 Aug 2010 08:02:47 +0000</DateUpdated>
     <ParentCallSid/>
     <AccountSid>AC5ef872f6da5a21de157d80997a64bd33</AccountSid>
     <To>+14153855708</To>
     <From>+14158141819</From>
     <PhoneNumberSid></PhoneNumberSid>
     <Status>completed</Status>
     <StartTime>Tue, 10 Aug 2010 08:02:31 +0000</StartTime>
     <EndTime>Tue, 10 Aug 2010 08:02:47 +0000</EndTime>
     <Duration>16</Duration>
     <Price>-0.03000</Price>
     <Direction>outbound-api</Direction>
    </Call>
   </TwilioResponse>

I can get to the XML data by using CURL which works fine like this:

    $handle = curl_init();
    curl_setopt($handle, CURLOPT_URL, $base_url."/Accounts/{$accountSid}/Calls");
    curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
    $response = curl_exec($handle);
    curl_close($handle);

however once I get the data back as XML I try and put it into a simpleXML element and return it back to the page that called this function as follows:

    $xml = new SimpleXmlElement($response);
    if($xml)
{
  return $xml;
}
else
{
  return false;
}

When I return the XML to the page that called the function, I can see a whole lot of simpleXMLElement Objects if I do a print_r() but when I try and do a foreach($xml->TwilioResponse->call as $call) I get nothing and it does not seem like I can actually drill into the data at all.

Can someone help me and point out where I am going wrong with this? It has been driving me absolutely crazy for the past couple of hours.

THANKS!

  • 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-27T23:55:13+00:00Added an answer on May 27, 2026 at 11:55 pm

    It looks like there are two problems with $xml->TwilioResponse->call.

    1. $xml contains the TwilioResponse element (the “document element”), $xml->TwilioResponse is incorrect.
    2. (XML and) SimpleXML element names are case-sensitive, call should be Call.

    Give $xml->Call a spin.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use Google Analytics API to query internal searches that happen on
I'm trying to use the Remote Desktop API on a remote machine that I
I'm trying to use jQuery to call some custom API via Ajax/$.getJSON . I'm
I've been trying to use the feature of the imgur API that allows you
I'm trying to use an API under Delphi. Here's the API documentation: OKERR ENTRY
I've trying to use the API for CapsuleCRM... http://capsulecrm.com/help/page/api_gettingstarted I've been reading some articles
I'm trying to use the sharepoint API to deploy some solutions and the global
I'm trying to use the CoreCon API in Visual Studio 2008 to programmatically launch
I am trying to use the win32 API to set the parent of an
I'm trying to use the RegisteredWindowMessage API function to send text from one application

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.