Skip to content

Instantly share code, notes, and snippets.

@ghostbitmeta
Created June 25, 2015 00:37
Show Gist options
  • Save ghostbitmeta/df1d4cd318852f874969 to your computer and use it in GitHub Desktop.
Save ghostbitmeta/df1d4cd318852f874969 to your computer and use it in GitHub Desktop.
PHP Interface for IFTTT Maker
<?php
$TOKEN = "INSERT_RANDOM_TOKEN_HERE";
# Capture JSON content
$input=json_decode(file_get_contents('php://input'), true);
# Check if correct TOKEN passed or else redirect to Google
if($input['token'] != $TOKEN) {
header('Location: http://www.google.com/');
exit;
}
switch ($input['type']) {
case 'purifier':
if ($input['action'] == "toggle") {
$output=shell_exec("ssh pi@10.0.0.23 '/opt/air_purifier.sh on'");
exit;
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment