Skip to content

Instantly share code, notes, and snippets.

@notifo
Created June 30, 2010 06:08
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notifo/458296 to your computer and use it in GitHub Desktop.
Save notifo/458296 to your computer and use it in GitHub Desktop.
<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