I am trying to send SMS through my PHP website using the AWS SDK. I am using the code from Sending SMS using Amazon AWS PHP services .
require $_SERVER['DOCUMENT_ROOT'] . '/inc/aws/aws-autoloader.php';
error_reporting(E_ALL);
ini_set("display_errors", 1);
$params = array(
'credentials' => array(
'key' => 'abc',
'secret' => 'abc',
),
'region' => 'eu-west-1',
'version' => 'latest'
);
$sns = new \Aws\Sns\SnsClient($params);
$args = array(
"SenderID" => "TestSender",
"SMSType" => "Transational",
"Message" => "Sending SMS with PHP",
"PhoneNumber" => "+12345678"
);
$result = $sns->publish($args);
echo "<pre>";
var_dump($result);
echo "</pre>";
This does not work. I checked many different SenderIDs and all messages were received from NOTICE. However, when I send a message from the AWS console, the message is received with the correct sender ID. Therefore, I assume that my code is incorrect.
source
share