Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Send PEI Energy Interchange report to a Nabaztag rabbit
<?php
$apiKey = "get this from nabaztag.com";
$localDir = "/www/htdocs-ruk/nabaztag/wav";
$webDir = "http://media.ruk.ca/nabaztag/wav";
$id = uniqid();
$nbso = simplexml_load_file("http://energy.reinvented.net/pei-energy/nbso/get-nbso-data.php?format=xml");
$message = "P E I energy interchange is " . $nbso->PEI . " megawatts";
system("/usr/local/bin/swift \"" . escapeshellarg($message) . "\" -o $localDir/$id.wav");
$fp = fopen("http://www.nabalive.com/nabaztags/$apiKey/play?url=" . urlencode("$webDir/$id.wav"),"r");
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.