Created
June 25, 2015 00:37
-
-
Save ghostbitmeta/df1d4cd318852f874969 to your computer and use it in GitHub Desktop.
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 [email protected] '/opt/air_purifier.sh on'"); | |
exit; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment