public function testGetAccountInformation() { $robowhois = new RoboWhois("aaa", new Client()); $account = $robowhois->account(); $this->assertInstanceOf('RoboWhois\\Account', $account); $this->assertEquals('4ef12dbfca71cce5fd000001', $account['id']); $this->assertEquals('*****@*****.**', $account['email']); $this->assertEquals('0123456789', $account['api_token']); $this->assertEquals(480, $account['credits_remaining']); $this->assertEquals(480, $account->getCreditsRemaining()); }
<?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(); }