Php 使用aws sns向印度号码发送短信

Php 使用aws sns向印度号码发送短信,php,sms,amazon-sns,aws-php-sdk,Php,Sms,Amazon Sns,Aws Php Sdk,我正在尝试使用以下代码使用aws sns向特定号码发送短信,但它需要目标/主题arn,这不适用于我,因为我想向参数中设置的号码发送短信 $client = SnsClient::factory([ 'credentials' => [ 'key' => "my key", 'secret' => "my secret" ], 'region' => "us-east-1

我正在尝试使用以下代码使用aws sns向特定号码发送短信,但它需要目标/主题arn,这不适用于我,因为我想向参数中设置的号码发送短信

$client = SnsClient::factory([
        'credentials' => [
            'key'    => "my key",
            'secret' => "my secret"
        ],
        'region'  => "us-east-1",
        'version' => "latest"
    ]);

    $sent = $client->publish(
        [

            'Message' => 'This is the message',
            'PhoneNumber' => '+91887******7'
        ]
    );
我无法找到发布对象的确切参数。

来自:

targetran:如果未为targetran参数指定值,则必须为PhoneNumber或TopicArn参数指定值。 TopicArn:如果没有为TopicArn参数指定值,则必须为PhoneNumber或Targetran参数指定值。 PhoneNumber:如果未为PhoneNumber参数指定值,则必须为TargetArn或TopicArn参数指定值。
因此,请提供电话号码,而不是目标/主题。

我必须更新aws php sdk。那么下面的代码就可以正常工作了-

$sns = SnsClient::factory(array(
        'credentials' => array(
            'key' => 's3_key',
            'secret' => 's3_secret'
        ),
        'region' => Constants::$s3Region,
        'version' => 'latest'
    ));

$msgattributes = [
        'AWS.SNS.SMS.SenderID' => [
            'DataType' => 'String',
            'StringValue' => 'Klassroom',
        ],
        'AWS.SNS.SMS.SMSType' => [
            'DataType' => 'String',
            'StringValue' => 'Transactional',
        ]
    ];

    $payload = array(
        'Message' => $message,
        'PhoneNumber' => $number,
        'MessageAttributes' => $msgattributes
    );

    $result=$sns->publish($payload);