📜  php 为 aws sns sdk 2 发送短信 - 任何代码示例

📅  最后修改于: 2022-03-11 15:00:39.500000             🧑  作者: Mango

代码示例1
// update file: aws-sdk-php/src/Aws/Sdk/Resources/sns-2010-03-31.php

'Publish' => array(
    'parameters' => array(
        'PhoneNumber' => array( // new parameter
            'type' => 'string',
            'location' => 'aws.query',
        ),
    ),
),

// You just need to publish it and include the `PhoneNumber` parameter
$snsClientResult = $snsClient->publish([
    'Message' => 'YOUR_MESSAGE',
    'PhoneNumber' => 'PHONE_NUMBER',
    'MessageStructure' => 'SMS',
    'MessageAttributes' => [
        'AWS.SNS.SMS.SenderID' => [
            'DataType' => 'String',
            'StringValue' => 'SENDER_ID',
        ],
        'AWS.SNS.SMS.SMSType' => [
            'DataType' => 'String',
            'StringValue' => 'Promotional', // Transactional
        ]
    ]
]);

// Get the response
$snsClientResult['MessageId']