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

  • Home
  • SEARCH
  • 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 6211605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:22:06+00:00 2026-05-24T06:22:06+00:00

I am ignorant when it comes to SOAP. I am performing a web service

  • 0

I am ignorant when it comes to SOAP. I am performing a web service call:

<?php
// define the SOAP client using the url for the service
$client = new soapclient('http://www.xignite.com/xMetals.asmx?WSDL', array('trace' => 1));

// create an array of parameters 
$param = array(
           'Type' => "XAU",
           'Currency' => "USD");



// call the service, passing the parameters and the name of the operation 
$result = $client->GetLastRealTimeMetalQuote($param);
// assess the results 
if (is_soap_fault($result)) {
 echo '<h2>Fault</h2><pre>';
 print_r($result);
 echo '</pre>';
} else {
 echo '<h2>Result</h2><pre>';
 print_r($result);
 echo '</pre>';
}

?>

and when I run the script i get:

Result

stdClass Object
(
[GetLastRealTimeMetalQuoteResult] => stdClass Object
    (
        [Outcome] => Success
        [Identity] => IP
        [Delay] => 0.006
        [Symbol] => XAUUSDO
        [Type] => XAU
        [Currency] => USD
        [Date] => 8/1/2011
        [Time] => 11:18:48 PM
        [Rate] => 1618.88500977
        [Bid] => 1618.55004883
        [BidTime] => 11:18:48 PM
        [Ask] => 1619.2199707
        [AskTime] => 11:18:48 PM
    )

)

How do I separate the [Bid] out from the rest of the result and store it in a variable.

Or better yet how can I pull out the array?

  • 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-24T06:22:07+00:00Added an answer on May 24, 2026 at 6:22 am

    Don’t let the stdClass object mix you up – this is simply an array that is represented with object notation. So, $result['GetLastRealTimeMetalQuoteResult']['Bid'] (a normal associative array) becomes $result->GetLastRealTimeMetalQuoteResult->Bid – same values, just a different notation.

    You get stdClass objects when a value is typecast into an object, which the SOAP library does. See: http://php.net/manual/en/reserved.classes.php For some more detail about stdClass, check out this article: http://krisjordan.com/dynamic-properties-in-php-with-stdclass

    If you’d like to convert the stdClass to an array, unfortunately you’ll have to use a little function:

    function objToArray($obj=false)  {
        if (is_object($obj))
            $obj= get_object_vars($obj);
        if (is_array($obj)) {
            return array_map(__FUNCTION__, $obj);
        } else {
            return $obj;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the mclust library for R ( http://www.stat.washington.edu/mclust ) to do some experimental
Firstly, I'm new to Android (so I apologize if this question is ignorant) but
I fully accept that I am ignorant when it comes to SQL Server CE
I've never been using logging, so I'm pretty ignorant about it. Anyway I've a
I am somewhat ignorant about modern web technology, last have played with them way
I'm new and a little ignorant in C++ and I encounter a C++ code
Apologies if this is too ignorant a question or has been asked before. A
This could well be a terribly ignorant question, if so please forgive me: I'm
I'm completely ignorant of SQL/databases, but I was chatting with a friend who does
Aplogies for the ignorant question, I have no experience with app development on any

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.