On the command-line, use composer to get the AWS SDK for PHP
composer require aws/aws-sdk-php
Then test it by using the sns.php file
StackOverflow,Sending SMS with Amazon AWS services PHP
On the command-line, use composer to get the AWS SDK for PHP
composer require aws/aws-sdk-php
Then test it by using the sns.php file
StackOverflow,Sending SMS with Amazon AWS services PHP
require './vendor/autoload.php'; | |
error_reporting(E_ALL); | |
ini_set("display_errors", 1); | |
$params = array( | |
'credentials' => array( | |
'key' => 'YOUR_KEY_HERE', | |
'secret' => 'YOUR_SECRET_HERE', | |
), | |
'region' => 'ap-southeast-1', // < your aws from SNS Topic region | |
'version' => 'latest' | |
); | |
$sns = new \Aws\Sns\SnsClient($params); | |
$args = array( | |
"SenderID" => "SenderName", | |
"SMSType" => "Transactional", | |
"Message" => "Hello World!", | |
"PhoneNumber" => "FULL_PHONE_NUMBER" // +cc####### | |
); | |
$result = $sns->publish($args); | |
echo "<pre>"; | |
var_dump($result); | |
echo "</pre>"; |