Amazon SNS developing don't send sms

时间:2018-06-04 16:38:10

标签: php amazon-web-services amazon-sns

I'm using a script to send with Amazon SNS some text messages through their API in PHP. The problem which I am trying to solve is how I can test my script without sending everytime the text message. Is there a possibility to enter a kind of 'developing key' whichs give me a full send report in PHP without sending the text message to my mobile phone? I previous used Messagebird and there is this possible.

Thank you.

require './vendor/autoload.php';
error_reporting(E_ALL);
ini_set("display_errors", 1);

$params = array(
    'credentials' => array(
        'key' => 'ABCKEY123',
        'secret' => 'ABCSECRET123',
    ),
    'region' => 'us-east-1',
    'version' => 'latest'
);
$sns = new \Aws\Sns\SnsClient($params);

$args = array(
    "SenderID" => "NAME",
    "SMSType" => "Transactional",
    "Message" => "Message",
    "PhoneNumber" => "+31612345678"
);

$result = $sns->publish($args);
echo "<pre>";
var_dump($result);
echo "</pre>";

1 个答案:

答案 0 :(得分:0)

您需要将代码修改为 NOT 发送到Amazon SNS,或者您可以将其发送到 Amazon SNS主题,只需将消息作为电子邮件。