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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:13:04+00:00 2026-06-10T10:13:04+00:00

I am using a cloud based contact management system API with PHP library that

  • 0

I am using a cloud based contact management system API with PHP library that returns the following code when I use print_r($xml) (in View Source) when searching for a contact:

SimpleXMLElement Object
(
[id12345] => SimpleXMLElement Object
    (
        [id] => 12345
        [name] => Bob Smith
        [parentid] => 51214064
        [parentcn] => EGCTeam
        [flagged] => SimpleXMLElement Object
            (
            )

        [created] => 2012-08-24T18:39:22+00:00
        [viewed] => 2012-08-28T10:39:49+00:00
        [updated] => 2012-08-28T10:41:05+00:00
    )

[count] => 1
[status] => success
)

Normally I would use this code to access the “name” field:

$contactName = $xml->id12345->name

But since the first node includes the ID that I don’t know, how do I access the values of the contact? I tried this:

$contactName = $xml->children()->name

but it didn’t work (came out blank). Any help would be appreciated.

  • 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-06-10T10:13:06+00:00Added an answer on June 10, 2026 at 10:13 am

    You can use SimpleXMLElement::getName function to get the name of the SimpleXML element and parse the id from the name by getting the string after id.

    For example (if $response is the SimpleXML element):

    foreach ($response->children() as $child)
    {
        $name = $child->getName();
        $id = substr($name, 2);
        // Do stuff here with id or access node by $name //
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using http://cloud.github.com/downloads/emberjs/ember.js/ember-0.9.5.js and I'm not sure how to use the mouseenter and mouseleave
I'm toying with the idea of embarking on a cloud-based client/server spare-time project using
I'm considering using Fat Entities from Lokad.Cloud in a new Azure based application. At
We have an ASP.NET MVC3 based Web role running on the Azure cloud, using
OK, so I'm using LINQ to generate a tag cloud based on tags in
My project contains tagcloud and I am following the sample on: http://www.mikesdotnetting.com/Article/107/Creating-a-Tag-Cloud-using-ASP.NET-MVC-and-the-Entity-Framework My problem
I am currently creating a tag cloud that currently displays the tag based on
I want to use Rackspace API which is based on ReST. I am able
The following is my implememtation for using cloud to device messaging 1) I registered
I'm building an Amazon EC-2 cloud-based build server for my personal development projects using

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.