forked from danielbala/API-Examples
/
index.php
48 lines (41 loc) · 1.36 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
require_once("./includes/clientService.php");
if (!isset($_POST['submit'])) {
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>List Class Descriptions Demo</title>
<link rel="stylesheet" type="text/css" href="../styles/site.css" />
</head>
<body>
<form method="post" action=".">
Source Name:
<input type="text" size="25" name="sName"/><br/>
Password:
<input type="password" size="25" name="password"/><br/>
SiteID:
<input type="text" size="5" name="siteID" value="-99"/><br/>
<input type="submit" value="submit" name="submit"/>
</form>
<?php
} else {
$sourcename = $_POST["sName"];
$password = $_POST["password"];
$siteID = $_POST["siteID"];
// initialize default credentials
$creds = new SourceCredentials($sourcename, $password, array($siteID));
$clientService = new MBClientService();
$clientService->SetDefaultCredentials($creds);
$result = $clientService->GetClients(array());
$cdsHtml = '<table><tr><td>ID</td><td>Name</td></tr>';
$cds = toArray($result->GetClassDescriptionsResult->ClassDescriptions->ClassDescription);
foreach ($cds as $cd) {
$cdsHtml .= sprintf('<tr><td>%d</td><td>%s</td></tr>', $cd->ID, $cd->Name);
}
$cdsHtml .= '</table>';
echo($cdsHtml);
}
?>
</body>
</html>