public function testErrorHandling() { try { $this->client->checkDomainAvailability(array('DomainName' => 'amazon.com', 'IdnLangCode' => 'zzz')); $this->fail('An exception should have been thrown.'); } catch (ServiceResponseException $e) { $this->assertInstanceOf('Aws\\Route53Domains\\Exception\\Route53DomainsException', $e); $this->assertEquals('InvalidInput', $e->getExceptionCode()); } }
/** * @covers Aws\Route53Domains\Route53DomainsClient::factory */ public function testFactoryInitializesClient() { $client = Route53DomainsClient::factory(array('key' => 'foo', 'secret' => 'bar', 'region' => 'us-east-1')); $this->assertInstanceOf('Aws\\Common\\Signature\\SignatureV4', $client->getSignature()); $this->assertInstanceOf('Aws\\Common\\Credentials\\Credentials', $client->getCredentials()); $this->assertEquals('https://route53domains.us-east-1.amazonaws.com', $client->getBaseUrl()); }
<?php session_start(); // if(!empty($_SESSION['user'])){ require 'vendor/autoload.php'; use Aws\Route53Domains\Route53DomainsClient; ////////////////// require_once '/connectivity/aws_keys.php'; $keys = aws_keys(); $access_key = $keys['access_key']; $secret_key = $keys['secret_key']; ////////////////////////// $client = Route53DomainsClient::factory(array('version' => 'latest', 'region' => "us-east-1", 'credentials' => array('key' => $access_key, 'secret' => $secret_key))); //public function is_domain_available($domain) //{ $domain_name = $_POST['new_domain']; $result = $client->checkDomainAvailability(['DomainName' => $_POST['new_domain'], 'IdnLangCode' => '']); //} //$result=is_domain_available($_POST['new_domain']); if (!empty($result)) { $result = $result->toArray(); if (!empty($result)) { $_SESSION['rdomain'] = array("status" => $result['Availability'], "domain" => $domain_name); } } else { $_SESSION['rdomain'] = array("status" => "Some thing went wrong!", "domain" => $domain_name); } header("Location: /aws_r53/domain_home.php"); // }