Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.