Untitled UI logotext
Solutions
WebsitesEcommerceMobile AppsWeb AppsProduction Support & Maintenance
Our work
Company
About usBlogPodcastContact us
Book a free consultation

Slicehost API Made Easy

Olivia Rhye

I've been playing with the Slicehost API and ran accross PHP interface for the Slicehost API and am now sold on using PHP for the slicehost API. Track multiple slices, multiple accounts if you like. You can also launch slices or delete them as needed. Here's how to grab a bunch of info about your account:

include('slicemanager.php');

$api_key = ''; //Enter your API Key

$sm = new SliceManager($api_key);

echo "======== Slices ========\n";
foreach($sm->listSlices() as $slice)
{
echo 'Name: '.$slice['name']."\n";
echo 'Status: '.$slice['status']."\n";
echo 'Bandwidth-in: '.$slice['bw-in']."\n";
echo 'Bandwidth-out: '.$slice['bw-out']."\n";
echo 'Bandwidth-total: '.((float)$slice['bw-in'] + (float)$slice['bw-out'])."\n";
echo "\n";
}

echo "======== Zones ========\n";
foreach($sm->listZones() as $zone => $info)
{
echo 'Zone: '.$zone."\n";
echo 'ID: '.$info['id']."\n";
echo 'TTL: '.$info['ttl']."\n";
echo 'Active: '.$info['active']."\n";
echo "\n";
}

Ready to start a project?

Book a free consultation
Untitled UI logotext
Our work
About us
Blog
Careers
Submit a ticket
Agency Partnerships
Contact
© 2024 fjorge. All rights reserved.
Privacy