-
Notifications
You must be signed in to change notification settings - Fork 6
/
example.php
63 lines (41 loc) · 1.42 KB
/
example.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
57
58
59
60
61
62
63
<?php
/*
* Amazon SNS example script
*
* This will help you setup a topic, add a subscriber and pubish a sample
* message to the topic.
*
* Be sure to customize the details as required.
*
* After this, you'll need to run the script once to create the topic &
* add you as a subsriber...
*
* Then uncomment the last line and publish to the topic.
*
* @author Russell Smith <[email protected]>
*/
/*
* Your access key for AWS
*/
define('AWS_ACCESS_KEY', '<your amazon access key>');
/*
* Your private AWS key
*/
define('AWS_PRIVATE_KEY', '<your amazon secret key>');
// Customize these variables...
$your_email = '[email protected]';
$topic_title = 'hello-world';
$topic_display_name = 'Amazon SNS Test';
// Then omment this next line out or remove when you're done setting up the above & run!
exit();
require_once 'class.amazon_sns_helper.php';
require_once 'class.amazon_sns_topic.php';
require_once 'class.amazon_sns_subscriber.php';
$topic = amazon_sns_topic::create($topic_title);
print 'Your topic ARN: ' . $topic->getArn() . "\n";
$topic->setDisplayName($topic_display_name);
// Create the new subscription - this will email you a "opt in" message
$subscriber = amazon_sns_subscriber::create($topic, $your_email);
// Note, publish won't work and commented out as you'll need to
// confirm the subscription by opting in first.
//$topic->publish('Amazon SNS Test message', 'Hello, world!');