Search code examples
phpxmlsoapwsdl

return data from xml using php


I have a MindBody API link (https://api.mindbodyonline.com/0_5/ClassService.asmx?WSDL) from it i wish to fetch the data using php. I can get the class schedule by the following code:

$parameters = array(
    'StartDateTime' => date('Y-m-d'), 
    'EndDateTime'   => date('Y-m-d', strtotime('today + 7 days'))
);
$data = $notASoapClient->GetClasses($parameters);

if (!empty($data['GetClassesResult']['Classes']['Class'])) 
{
    $classes = $notASoapClient->makeNumericArray($data['GetClassesResult']['Classes']['Class']);
    print_r($classes);
}

But I am not able to fetch GetClassVisits data, which will have the list of students enrolled in every class. Can anyone tell how I can do so?


Solution

  • From the wsdl you linked to there seems to be a method GetClassVisits. Since you already know how to call one method in the webservice ($data = $mb->GetClasses(array('StartDateTime'=>date('Y-m-d'), 'EndDateTime'=>date('Y-m-d', strtotime('today + 7 days'))))) you should be able to call the GetClassVisits. From what I've seen it takes one GetClassVisitsRequest which contains one ClassID:

    $mb->GetClasses(array('ClassID'=>12345));