我打电话给这样的API:
$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);
收到这样的回复:
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
响应通常是这样的吗? 如何以格式化方式获取数据?
答案 0 :(得分:1)
你可以像这样循环你的课程:
foreach ($classes->GetClassesResult->Classes->Class as $class) {
// ... do your stuff here
print_r($class);
}