Last active
April 21, 2020 08:08
-
-
Save kntmr/3f66744e04b28f7ebfb8723dfc139677 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require '../vendor/autoload.php'; | |
use Aws\Sqs\SqsClient; | |
use Aws\Exception\AwsException; | |
date_default_timezone_set('Asia/Tokyo'); | |
$client = new SqsClient([ | |
'region' => 'ap-northeast-1', | |
'version' => '2012-11-05' | |
]); | |
$params = [ | |
'MessageAttributes' => [ | |
'from' => [ | |
'DataType' => 'String', | |
'StringValue' => '<ADDRESS_FROM>' | |
], | |
'to' => [ | |
'DataType' => 'String', | |
'StringValue' => '<ADDRESS_TO>' | |
], | |
'subject' => [ | |
'DataType' => 'String', | |
'StringValue' => 'Test' | |
] | |
], | |
'MessageBody' => "Hello World!!", | |
'QueueUrl' => '<QUEUE_URL>' | |
]; | |
try { | |
$result = $client->sendMessage($params); | |
var_dump($result); | |
} catch (AwsException $e) { | |
error_log($e->getMessage()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment