confirm_subscription ( $topic_arn, $token, $opt )

The ConfirmSubscription action verifies an endpoint owner’s intent to receive messages by validating the token sent to the endpoint by an earlier Subscribe action. If the token is valid, the action creates a new subscription and returns its Amazon Resource Name (ARN). This call requires an AWS signature only when the AuthenticateOnUnsubscribe flag is set to “true”.

Access

public

Parameters

Parameter

Type

Required

Description

$topic_arn

string

Required

The ARN of the topic for which you wish to confirm a subscription.

$token

string

Required

Short-lived token sent to an endpoint during the Subscribe action.

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • AuthenticateOnUnsubscribe - string - Optional - Indicates that you want to disallow unauthenticated unsubscribes of the subscription. If value of this parameter is “true” and the request has an AWS signature then only the topic owner and the subscription owner will be permitted to unsubscribe the endpoint. The unsubscribe action will require AWS authentication.
  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Confirm a subscription to a topic.

$sns = new AmazonSNS();

// Subscribe to notifications
$response = $sns->confirm_subscription(
	'arn:aws:sns:us-east-1:9876543210:my-topic', // $topic
	'0NNAq8PwvXvg8EfAYG9sSmwKTZeixZgZNE6PbodG8td0DJ3gVOmjI2Gh/oFnb0Ie=' // $token
);

// Success?
var_dump($response->isOK());
Result:
bool(true)

Related Methods

Source

Method defined in services/sns.class.php | Toggle source view (8 lines) | View on GitHub

public function confirm_subscription($topic_arn, $token, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['TopicArn'] = $topic_arn;
    $opt['Token'] = $token;
    
    return $this->authenticate('ConfirmSubscription', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback