Skip to content

Instantly share code, notes, and snippets.

@underscorephil
Last active October 13, 2015 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save underscorephil/4271461 to your computer and use it in GitHub Desktop.
Save underscorephil/4271461 to your computer and use it in GitHub Desktop.
SoftLayer_Virtual_Guest::createObject - PHP
<?php
require_once('softlayer-api-php-client/SoftLayer/SoapClient.class.php');
$apiUsername = '';
$apiKey = '';
$client = Softlayer_SoapClient::getClient('SoftLayer_Virtual_Guest', null, $apiUsername, $apiKey);
try {
$templateObject = new stdClass();
$templateObject->hostname = 'test1';
$templateObject->domain = 'example.com';
$templateObject->startCpus = 1;
$templateObject->maxMemory = 1024;
$templateObject->hourlyBillingFlag = true;
$templateObject->operatingSystemReferenceCode = 'UBUNTU_LATEST';
$templateObject->localDiskFlag = false;
$templateObject->datacenter = new stdClass();
$templateObject->datacenter->name = 'dal05';
$result = $client->createObject($templateObject);
print_r($result);
} catch ( Exception $e) {
die( $e->getMessage());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment