Skip to content

Instantly share code, notes, and snippets.

@kntmr
Last active April 21, 2020 08:08
Show Gist options
  • Save kntmr/3f66744e04b28f7ebfb8723dfc139677 to your computer and use it in GitHub Desktop.
Save kntmr/3f66744e04b28f7ebfb8723dfc139677 to your computer and use it in GitHub Desktop.
<?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