Skip to content

Instantly share code, notes, and snippets.

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