PHP Interface for IFTTT Maker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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