1

我在“已验证的域名”列表中添加了一个新域名,更新了 DNS,现在我想通过 API(实际上是 PHP SDK)验证域名是否已被 aws 标记为已验证。到目前为止我有这个

function get_verified_status($domain, $key, $secret) {
// Instantiate the client with your AWS credentials
        $ses = SesClient::factory(array(
                    'key'     => $key,
                    'secret'  => $secret,
                    'region'  => Region::US_EAST_1
                ));
print_r($domain);
echo "response";
$response = $ses->GetIdentityVerificationAttributes($domain);
#$response = $ses->list_verified_email_addresses();

//get_identity_verification_attributes
        return $response;
}

响应是(从 cli 运行)

php test.php

Array
(
    [0] => appi.com
    [1] => acs.com
)
responsePHP Fatal error:  Uncaught exception 'Guzzle\Service\Exception\ValidationException' with message 'Validation errors: [Identities] is a required array: A list of identities.' in /var/www/html/s3/vendor/guzzle/guzzle/src/Guzzle/Service/Command/AbstractCommand.php:376
Stack trace:
#0 /var/www/html/s3/vendor/guzzle/guzzle/src/Guzzle/Service/Command/AbstractCommand.php(272): Guzzle\Service\Command\AbstractCommand->validate()
#1 /var/www/html/s3/vendor/guzzle/guzzle/src/Guzzle/Service/Client.php(193): Guzzle\Service\Command\AbstractCommand->prepare()
#2 /var/www/html/s3/vendor/guzzle/guzzle/src/Guzzle/Service/Command/AbstractCommand.php(162): Guzzle\Service\Client->execute(Object(Aws\Common\Command\QueryCommand))
#3 /var/www/html/s3/vendor/guzzle/guzzle/src/Guzzle/Service/Command/AbstractCommand.php(213): Guzzle\Service\Command\AbstractCommand->execute()
#4 /var/www/html/s3/vendor/guzzle/guzzle/src/Guzzle/Service/Client.php(93): Guzzle\Service\Command\AbstractCommand->getResult()
#5 /var/www/html/s3/vendo in /var/www/html/s3/vendor/guzzle/guzzle/src/Guzzle/Service/Command/AbstractCommand.php on line 376

我不明白为什么会出现此错误,因为我传递了一个数组,如打印中所示。我将衷心感谢您的帮助

4

1 回答 1

2

根据GetIdentityVerificationAttributes 的 AWS SDK for PHP API 文档,输入参数的结构表明您应该像这样调用该方法:

$result = $ses->getIdentityVerificationAttributes(array(
    'Identities' => $domains
));

print_r($result->toArray());

希望有帮助!

于 2013-06-11T18:57:05.877 回答