-
Notifications
You must be signed in to change notification settings - Fork 13
/
list-subscribers.php
36 lines (32 loc) · 1.05 KB
/
list-subscribers.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
<?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' );
$identifier = array
(
'id' => 'your-asset-id',
'type' => 'your-asset-type'
);
$listSubscribersParams = array ('authentication' => $auth, 'identifier' => $identifier);
$reply = $client->listSubscribers($listSubscribersParams);
if ($reply->listSubscribersReturn->success=='true')
{
echo "Subscribers:\r\n";
$subscribers = $reply->listSubscribersReturn->subscribers->assetIdentifier;
if (sizeof($subscribers)==0)
{
echo "NONE\r\n";
exit;
}
else if (!is_array($subscribers)) // For less than 2 elements, the returned object isn't an array
$subscribers=array($subscribers);
foreach($subscribers as $identifier)
echo "[".$identifier->type."] site://".$identifier->path->siteName."/".$identifier->path->path."\r\n";
}
else
echo "Error occurred: " . $reply->listSubscribersReturn->message;
?>