checking a domains availability using php

The availability API is probably the greatest feature of the Robowhois webservice, letting you check for a domain’s availability with a simple, uniform HTTP request.

Checking if is available

isAvailable('')) {
echo "pretty nice dream, uhm?";

The opposite thing is achieved using the ->isRegistered() method.

You can also retrieve an array as returned from the webservice, by doing:
whoisAvailability('')) {
echo $availability['available'];
echo $availability['registered'];
echo $availability['daystamp'];

Retrieve informations about your account

A must-have, since you should always check how many remaining credits you have, the account API lets you retrieve some of your personal data from your account:

Calculating how many left credits you have


if ($credits > 100) {
echo "No problem fella!";
} else {
echo "Time to go shopping looking for new API calls, uhm?";
} catch (Exception $e) {
echo "The following error occurred: " . $e->getMessage();

Minor things

We also polished some code, refactored stuff and added some tests (unit and integration ones).

For instance, when using the record API, you can retrieve the daystamp of the response as DateTime object:

retrieving the daystamp as an object or a string

whoisRecord('')) {
// returns a DateTime object
echo $whois->getDaystamp();

// formats the DateTime
echo $whois->getDaystamp()->format('Y-m-d');

// returns a string
echo $whois->getDaystamp(true);

You can download the latest tag of the library (currently 0.8.0) and start using it: the README exhaustively explains what you can do with this small client, and some samples are provided under the

Source :