15
Feb
API
Posted by DaleCurrently offline for maintinance
By popular demand the Tool Names API has been release. The API is fairly simple ans straight forward. The down side is it is slow, this cannot be changed due the to the fact that it is controled by the server which determines if the domain is registered or not.
So to use the API you have three (3) variables
- pwords – the primary words, put a space between each word
- words – the secondary words, put a space between each word
- limit – the amount of results returned, best to keep it under 100
The the API uses REST so cURL and PHP is best. The code is:
function getDomains ($pwords, $words, $limit)
{
$url = 'http://toolnames.com/api.php';
$curl_handle = curl_init();
curl_setopt($curl_handle, CURLOPT_URL, "$url");
curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_handle, CURLOPT_POST, 1);
curl_setopt($curl_handle, CURLOPT_POSTFIELDS, "pwords=$pwords&words=$words&limit=$limit");
$domains = curl_exec($curl_handle);
curl_close($curl_handle);
$domains = new SimpleXMLElement($domains);
echo "Available domains to register<br />";
foreach ($domains->available->avdomain as $available)
{
echo $available . "<br />";
}
echo "Domains already registered<br />";
foreach ($domains->taken->tkdomain as $taken)
{
echo $taken . "<br />";
}
}





Post a Comment