The Subscribe action prepares to subscribe an endpoint by sending the endpoint a confirmation message. To actually create a subscription, the endpoint owner must call the ConfirmSubscription action with the token from the confirmation message. Confirmation tokens are valid for three days.
Access
public
Parameters
Parameter |
Type |
Required |
Description |
---|---|---|---|
|
Required |
The ARN of topic you want to subscribe to. |
|
|
Required |
The protocol you want to use. Supported protocols include:
|
|
|
Required |
The endpoint that you want to receive notifications. Endpoints vary by protocol:
|
|
|
Optional |
An associative array of parameters that can have the following keys:
|
Returns
Type |
Description |
---|---|
A |
Examples
Subscribe to a topic.
$sns = new AmazonSNS(); // Subscribe to notifications $response = $sns->subscribe( 'arn:aws:sns:us-east-1:9876543210:my-topic', 'sqs', 'arn:aws:sqs:us-east-1:9876543210:my-sqs-queue' ); // Success? var_dump($response->isOK());Result:
bool(true)
Related Methods
Source
Method defined in services/sns.class.php | Toggle source view (9 lines) | View on GitHub