01.
<?php
02.
ob_start();
03.
require_once
(
"lib/nusoap.php"
);
04.
05.
$server
=
new
soap_server();
06.
08.
09.
10.
$server
->configureWSDL(
"Get_Profile"
);
11.
12.
$varname
=
array
(
13.
14.
);
15.
16.
$server
->register(
'Get_Profile'
,
$varname
,
array
(
'return'
=>
'xsd:string'
));
17.
18.
function
Get_Profile(){
19.
20.
$objDb
= mysqli_connect(
"localhost"
,
"tkoffice_demo"
,
"DemoM3not"
,
"tkoffice_demo"
);
21.
22.
if
(!
$objDb
) {
23.
printf(
"ERROR: Cannot connect to database! Please contact customer service.\n"
);
24.
exit
(1);
25.
}
26.
27.
mysqli_query(
$objDb
,
"SET NAMES UTF8"
);
28.
mysqli_query(
$objDb
,
"SET character_set_results=UTF8"
);
29.
30.
$strProfile
=
"SELECT * FROM crs_profiles order by profile_id ASC"
;
31.
if
((
$objResult_Profile
= mysqli_query(
$objDb
,
$strProfile
)) != TRUE) {
32.
printf(
"ERROR: Cannot read Profile!\n"
);
33.
mysqli_close(
$objDb
);
34.
exit
(1);
35.
}
36.
37.
while
(
$row_profile
= mysqli_fetch_array(
$objResult_Profile
)) {
38.
$profileTypeId
=
$row_profile
[
"profile_type_id"
];
39.
$profileName
=
$row_profile
[
"description"
];
40.
41.
$strType
=
"SELECT * FROM crs_profile_types WHERE profile_type_id = '$profileTypeId'"
;
42.
if
((
$objResult_Type
= mysqli_query(
$objDb
,
$strType
)) != TRUE) {
43.
printf(
"ERROR: Cannot read Profile type!\n"
);
44.
mysqli_close(
$objDb
);
45.
exit
(1);
46.
}
47.
48.
if
(
$row_type
= mysqli_fetch_array(
$objResult_Type
)) {
49.
$typeName
=
$row_type
[
"abbr"
];
50.
}
51.
52.
$arr
[
'ProfileType'
] =
$typeName
;
53.
$arr
[
'ProfileName'
] =
$profileName
;
54.
header(
'Content-type: application/json'
);
55.
return
json_encode(
$arr
);
56.
}
57.
}
58.
59.
60.
61.
$POST_DATA
= isset(
$GLOBALS
[
'HTTP_RAW_POST_DATA'
]) ?
$GLOBALS
[
'HTTP_RAW_POST_DATA'
] :
''
;
62.
63.
64.
$server
->service(
$POST_DATA
);
65.
exit
();
66.
?>