forked from hannonhill/Webservices-PHP-Sample-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist-sites.php
27 lines (24 loc) · 836 Bytes
/
list-sites.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
<?php
$soapURL = "http://localhost:8080/ws/services/AssetOperationService?wsdl";
$client = new SoapClient
(
$soapURL,
array ('trace' => 1, 'location' => str_replace('?wsdl', '', $soapURL))
);
$auth = array ('username' => 'admin', 'password' => 'admin' );
$listSitesParams = array ('authentication' => $auth);
$reply = $client->listSites($listSitesParams);
if ($reply->listSitesReturn->success=='true')
{
$sites = $reply->listSitesReturn->sites->assetIdentifier;
if (sizeof($sites)==0)
$sites = array();
else if (!is_array($sites)) // For less than 2 eleements, the returned object isn't an array
$sites=array($sites);
echo "Sites:\r\n";
foreach($sites as $site)
echo $site->path->path . " (" . $site->id . ")\r\n";
}
else
echo "Error occurred when getting a list of sites: " . $reply->listSitesReturn->message;
?>