尝试通过AWS php sdk发送短信时出错。我的脚本如下:
require './aws-autoloader.php';
error_reporting(E_ALL);
ini_set("display_errors", 1);
$params = array(
'credentials' => array(
'key' => 'my_key',
'secret' => 'my_secret_key',
),
'region' => 'ap-south-1', // < your aws from SNS Topic region
'version' => 'latest'
);
$sns = new \Aws\Sns\SnsClient($params);
$args = array(
"SenderID" => "",
"SMSType" => "Transactional",
"Message" => "Hello World!",
"PhoneNumber" => "+919939067673"
);
$result = $sns->publish($args);
echo "<pre>";
var_dump($result);
echo "</pre>";
以下是我得到的错误:
致命错误:未捕获的异常&#39; Aws \ Sns \ Exception \ SnsException&#39;消息&#39;执行错误&#34;发布&#34; on&#34; https://sns.ap-south-1.amazonaws.com&#34 ;; AWS HTTP错误:客户端错误:POST https://sns.ap-south-1.amazonaws.com
导致400 Bad Request
响应:发件人InvalidPara (truncated...) InvalidParameter (client): Invalid parameter: PhoneNumber Reason: +919939067673 is not valid to publish to - Sender
响应:
InvalidParameter
Invalid parameter: PhoneNumber Reason: +919939067673 is not valid to publish to 9c89eb86-0ba4-5194-acdb-b8c03c139866 ' exception 'GuzzleHttp\Exception\ClientException' with message 'Client error: POST https://sns.ap-south-1.amazonaws.com
resulted in a 400 Bad Request
任何人都可以指导我这个。感谢名单