SearchTags.php
SearchTags.php
<?php
require_once ('Softlayer/SoapClient.class.php');
$apiUsername = 'set me';
$apiKey = 'set me';
$accountService = Softlayer_SoapClient::getClient('SoftLayer_Account', null, $apiUsername, $apiKey);
$tags = array("tag1", "tag2");
$filter = new stdClass();
$filter->virtualGuests = new stdClass();
$filter->virtualGuests->tagReferences = new stdClass();
$filter->virtualGuests->tagReferences->tag = new stdClass();
$filter->virtualGuests->tagReferences->tag->name = new stdClass();
$filter->virtualGuests->tagReferences->tag->name->operation = new stdClass();
$filter->virtualGuests->tagReferences->tag->name->operation = "in";
$filter->virtualGuests->tagReferences->tag->name->options = array();
$filter->virtualGuests->tagReferences->tag->name->options[0] = new stdClass();
$filter->virtualGuests->tagReferences->tag->name->options[0]->name = "data";
$filter->virtualGuests->tagReferences->tag->name->options[0]->value = $tags;
$accountService->setObjectFilter($filter);
try {
$result = $accountService->getVirtualGuests();
print_r($result);
} catch (Exception $e) {
echo 'Unable to search the tags : ' . $e -> getMessage();
}
?>