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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:48:20+00:00 2026-06-12T07:48:20+00:00

I call an webservice using PHP 5.3.1 and my request looks as so: <?php

  • 0

I call an webservice using PHP 5.3.1 and my request looks as so:

<?php

$client = new SoapClient('the API wsdl'); 
$param = array(
    'LicenseKey' => 'a guid'
  ); 


$result = $client->GetUnreadIncomingMessages($param);

echo "<pre>";
print_r($result);
echo "</pre>";

?>

Here is the response that I get back:

stdClass Object
(
[GetUnreadIncomingMessagesResult] => stdClass Object
    (
        [SMSIncomingMessage] => Array
            (
                [0] => stdClass Object
                    (
                        [FromPhoneNumber] => the number
                        [IncomingMessageID] => message ID
                        [MatchedMessageID] => 
                        [Message] => Hello there
                        [ResponseReceiveDate] => 2012-09-20T20:42:14.38
                        [ToPhoneNumber] => another number
                    )

                [1] => stdClass Object
                    (
                        [FromPhoneNumber] => the number
                        [IncomingMessageID] => 
                        [MatchedMessageID] => 
                        [Message] => hello again
                        [ResponseReceiveDate] => 2012-09-20T20:42:20.69
                        [ToPhoneNumber] => another number
                    )

            )

    )

)
  • 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-12T07:48:21+00:00Added an answer on June 12, 2026 at 7:48 am

    To get to the data you want to retrieve you need to navigate through multiple nested objects. The objects are of stdClass type. It is my understanding that you can access nested objects in a stdClass but I am going to cast them to arrays to make indexing easier.

    So start with:

    <?php     
    
    $client = new SoapClient('the API wsdl');      
    $param = array('LicenseKey' => 'a guid');      
    $result = $client->GetUnreadIncomingMessages($param);  
    

    You now have a $result vavialble of type stdClass. This has a single object in it also of type stdClass called “GetUnreadIncomingMessagesResult.” This Object in turn contains an array called “SMSIncomingMessage.” That array contains a varriable number of objects of stdClass that hold the data you want.

    So we do the following:

    $outterArray = ((array)$result);
    $innerArray = ((array)$outterArray['GetUnreadIncomingMessagesResult']);
    $dataArray = ((array)$innerArray['SMSIncomingMessage']);
    

    Now we have an array holding each object we want to extract data from. So we loop through this array to get the holding object, cast the holding object to an array and than extract the necessary information. You do this as follows:

    foreach($dataArray as $holdingObject)
                    {
                    $holdingArray = ((array)$holdingObject);
                    $phoneNum = $holdingArray['FromPhoneNumber'];
                    $message = $holdingArray['Message'];
    
                    echo"<div>$fphone</div>
                         <div>$message</div>";
    
                    }                   
    ?>
    

    This should give you the output you are looking for. You can adjust where you index the holdingArray to get out whatever specific information you are looking for.

    The complete code looks like:

    <?php     
    
        $client = new SoapClient('the API wsdl');      
        $param = array('LicenseKey' => 'a guid');      
        $result = $client->GetUnreadIncomingMessages($param); 
        $outterArray = ((array)$result);
        $innerArray = ((array)$outterArray['GetUnreadIncomingMessagesResult']);
        $dataArray = ((array)$innerArray['SMSIncomingMessage']);
        foreach($dataArray as $holdingObject)
        {
             $holdingArray = ((array)$holdingObject);
             $phoneNum = $holdingArray['FromPhoneNumber'];
             $message = $holdingArray['Message'];
    
             echo"<div>$fphone</div>
                  <div>$message</div>";
        }
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to call to a SOAP WebService using PHP SoapClient, connecting with a
Folks, I'm using SOAPClient in PHP to call a .NET webservice. All fine and
I have come up with the following code to call a webservice using client/server
I'm using a method using SoapClient class in a php page to call a
I'm using PHP's HTTPRequest to call a webservice with the following code: <?php $req
I am completely new PHP and want a client program to call an URL
I'm trying to call an AspNet WebService (C# 3.5) from PHP (5.3.5) using NuSoap.
I'm trying to call a php webservice using WCF. I googled some public php
So, I'm trying to consume a webservice using something like this: $client = new
Using this php script, I can call a webservice. The file names will be

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.