Created
June 30, 2010 06:08
-
-
Save notifo/458296 to your computer and use it in GitHub Desktop.
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
<html> | |
<body> | |
<form name="themform" action="./notifo_form_submit.php" method="POST"> | |
Send a message to Stammy! | |
<p/> | |
<textarea rows=10 cols=30 name="message"> | |
Happy Birthday! | |
</textarea> | |
<p/> | |
<input type=hidden name="submitted" value="1" /> | |
<input type=submit value="Send Notifo to Stammy!" /> | |
</form> | |
</body> | |
</html> |
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
<? | |
function clean_input($input) { | |
/* use preferred input cleaning techniques here... */ | |
/* | |
$input = ...; | |
*/ | |
return $input; | |
} | |
/* Notifo_API.php found in http://github.com/notifo/Notifo-API-Libraries */ | |
include("Notifo_API.php"); | |
if ($_POST["submitted"] != 1) { | |
die(); | |
} | |
$notifo_username = "username"; | |
$notifo_apisecret = "sekretkey"; | |
$notifo = new Notifo_API($notifo_username, $notifo_apisecret); | |
$data = array(); | |
$data["msg"] = clean_input($_POST["message"]); | |
$data["uri"] = "http://happybirthday.com/"; | |
$data["title"] = "Happy Birthday!"; | |
$data["label"] = "Form Message"; | |
$response = $notifo->send_notification($data); | |
$aux = json_decode($response); | |
if ($aux->status == "success") { | |
?> | |
<html> | |
<body> | |
Notifo Sent! | |
</body> | |
</html> | |
<? } else { ?> | |
<html> | |
<body> | |
Oops, something went wrong! | |
<p/> | |
<?=$aux->response_message;?> | |
</body> | |
</html> | |
<? } /* end if */ ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment