/** * @expectedException RoboWhois\Exception */ public function testExecutingUnauthenticatedRequests() { $domain = "robowhois.com"; $robowhois = new RoboWhois("..."); $index = $robowhois->whois($domain); $this->assertEquals($this->stripSpecials($index->getContent()), $this->stripSpecials(StubClient::getContent($domain))); $this->assertInstanceOf('RoboWhois\\Whois\\Index', $index); }
<?php use RoboWhois\RoboWhois; use RoboWhois\Exception; require 'vendor/autoload.php'; $robowhois = new RoboWhois('INSERT-YOUR-API-KEY-HERE'); try { $domain = $robowhois->whoisProperties('robowhois.com'); echo $domain['properties']['created_on'] . "\n"; } catch (Exception $e) { echo "The following error occurred: " . $e->getMessage(); }
<?php use RoboWhois\RoboWhois; use RoboWhois\Exception; require 'vendor/autoload.php'; $robowhois = new RoboWhois('INSERT-YOUR-API-KEY-HERE'); try { $domain = $robowhois->whoisParts('robowhois.com'); echo $domain['parts'][0]['body'] . "\n"; } catch (Exception $e) { echo "The following error occurred: " . $e->getMessage(); }
<?php use RoboWhois\RoboWhois; use RoboWhois\Exception; require 'vendor/autoload.php'; $robowhois = new RoboWhois('INSERT-YOUR-API-KEY-HERE'); try { echo $robowhois->whois('robowhois.com'); } catch (Exception $e) { echo "The following error occurred: " . $e->getMessage(); }
<?php use RoboWhois\RoboWhois; use RoboWhois\Exception; require 'vendor/autoload.php'; $robowhois = new RoboWhois('INSERT-YOUR-API-KEY-HERE'); try { $whois = $robowhois->whoisRecord('robowhois.com'); echo $whois['daystamp'] . "\n"; echo $whois->getRecord(); } catch (Exception $e) { echo "The following error occurred: " . $e->getMessage(); }
public function testWhoisParts() { $robowhois = new RoboWhois("aaa", new Client()); $domain = $robowhois->whoisParts('partsdomain.com'); $this->assertEquals('2011-08-23', $domain['daystamp']); $this->assertInstanceOf('RoboWhois\\ArrayObject', $domain->getParts()); $this->assertNotEmpty($domain['parts'][0]['body']); }
<?php use RoboWhois\RoboWhois; use RoboWhois\Exception; require 'vendor/autoload.php'; $robowhois = new RoboWhois('INSERT-YOUR-API-KEY-HERE'); try { $domains = array('google.com', 'mycustomabsurddomainnamenooneeverregistered.ch'); foreach ($domains as $domain) { $availability = $robowhois->whoisAvailability($domain); if ($availability['available']) { echo sprintf("%s is available!", $domain) . "\n"; } else { echo sprintf("%s is registered!", $domain) . "\n"; } } } catch (Exception $e) { echo "The following error occurred: " . $e->getMessage(); }
<?php use RoboWhois\RoboWhois; use RoboWhois\Exception; require 'vendor/autoload.php'; $robowhois = new RoboWhois('INSERT-YOUR-API-KEY-HERE'); try { $account = $robowhois->account(); echo $account->getCreditsRemaining(); } catch (Exception $e) { echo "The following error occurred: " . $e->getMessage(); }