notifo (owner)

Revisions

gist: 458296 Download_button fork
public
Public Clone URL: git://gist.github.com/458296.git
Embed All Files: show embed
notifo_form.php #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<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>
notifo_form_submit.php #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?

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 */ ?>
Please log in to comment.