How to get a nicely formatted PHP Web Service response?

Posted by Bruno on Stack Overflow See other posts from Stack Overflow or by Bruno
Published on 2012-06-17T21:05:03Z Indexed on 2012/06/17 21:16 UTC
Read the original article Hit count: 181

Filed under:
|

I called an API like this:

$service = new Class_Service();

$parameters = new GetClasses();
$parameters->Request = new GetClassesRequest();

$parameters->Request->SourceCredentials = new SourceCredentials();
$parameters->Request->SourceCredentials->SourceName = "Name";
$parameters->Request->SourceCredentials->Password = "Pass";
$parameters->Request->SourceCredentials->SiteIDs = array(
12
);

$classes = $service->GetClasses($parameters);

var_dump($classes);

And received a response like this:

object(GetClassesResponse)#7 (1) { 
  ["GetClassesResult"]=> 
    object(GetClassesResult)#8 (6 {
      ["Classes"]=> 
        object(stdClass)#9 (1) { 
          ["Class"]=> array(25) { 
            [0]=> object(Mi_Class)#10 (21) {
               ["ClassScheduleID"]=> int(15)
               ["Visits"]=> NULL
               ["Clients"]=> NULL 
               ["Location"]=> object(Location)#11 (30) { 
                 ["BusinessID"]=> NULL
                 ["SiteID"]=> int(12)
                 ["BusinessDescription"]=> NULL
                 ["AdditionalImageURLs"]=> object(stdClass)#12 (0) { }
                 ["FacilitySquareFeet"]=> NULL

Does a response normally look like this? How do I go about getting the data in a formatted manner?

© Stack Overflow or respective owner

Related posts about php

Related posts about wsdl