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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:25:04+00:00 2026-06-03T23:25:04+00:00

I have a codeigniter app that queryies an api and gets a simplexml object.

  • 0

I have a codeigniter app that queryies an api and gets a simplexml object. I had hard coded the values I wanted from the simplexml object, but found out later that the structure of the object isn’t always the same, so I can’t use casting to get the values I need.

Is there an array_search like function that I could use for this so I can use the “classid” to get the value? Here is a sampling of the simplexml object:

    [Package] => SimpleXMLElement Object
    (
        [@attributes] => Array
            (
                [ID] => e981b9a72cd305c7d97cc530ef9b3015
            )

        [Postage] => Array
            (
                [0] => SimpleXMLElement Object
                    (
                        [@attributes] => Array
                            (
                                [CLASSID] => 3
                            )

                        [MailService] => Express Mail<sup>&reg;</sup>
                        [Rate] => 57.60
                    )

                [1] => SimpleXMLElement Object
                    (
                        [@attributes] => Array
                            (
                                [CLASSID] => 2
                            )

                        [MailService] => Express Mail<sup>&reg;</sup> Hold For Pickup
                        [Rate] => 57.60
                    )

                [2] => SimpleXMLElement Object
                    (
                        [@attributes] => Array
                            (
                                [CLASSID] => 55
                            )

                        [MailService] => Express Mail<sup>&reg;</sup> Flat Rate Boxes
                        [Rate] => 39.95
                    )

I was using this to get the [Rate] value:

$usps->Package->Postage[0]->Rate

The problem is I need to use [CLASSID] because that is consistant where the data in the number key(?) changes.

  • 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-03T23:25:06+00:00Added an answer on June 3, 2026 at 11:25 pm

    Use XPath

    You can not only search for specific elements, but do all kinds of crazy searches using various axes.

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

Sidebar

Related Questions

I have an Codeigniter app (using version 2.1.0) that is writing a transaction to
I have a form that submits data to a database in a CodeIgniter app
I have a CodeIgniter app that works on one server (IIS 6) just fine.
i have written a small codeigniter test app that is currently running on my
How do I configure a CodeIgniter app so I can have one directory that
I have a site that uses wordpress for the frontend & a Codeigniter app
I'm working on an app in CodeIgniter, and I want to have admin pages
I'm using CodeIgniter (a PHP framework) to build an app, and I have an
I have a codeigniter code that is working on local Apache installation. But it
I have a codeigniter webform, I want to input city/state details from the user,

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.