Skip to content

Instantly share code, notes, and snippets.

@reinvented
Created January 3, 2012 21:17
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 reinvented/1556980 to your computer and use it in GitHub Desktop.
Save reinvented/1556980 to your computer and use it in GitHub Desktop.
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