Domain Information
This function allows you to build and return an object representing a given domain. The attributes of the object can include data including nameservers, expiry date, registrar and transfer lock status, domain contact verification status and more.
it is recommended to use the GetDomainInformation function in place of the individual GetNameservers and GetRegistrarLock functions in scenarios where a single API call can retrieve both nameservers and registrar lock status for best performance.
Example Usage
The function expects a return of a WHASOLS Registrar Domain object.
The example below demonstrates setting all supported domain attributes at the time of writing.
<?php
function yourmodule_GetDomainInformation($params)
{
$tld = $params['tld'];
$sld = $params['sld'];
$api = yourmodule_getApiClient($params);
$domain = $sld . '.' . $tld;
$domain = onlinenic_Idn_getDomainInfo($domain);
try {
$domainInfo = $api->infoDomain($domain,'IRTP');
} catch (\Exception $e) {
return ['status'=>'error','message' => 'Failed to get Domain Info:' . $e->getMessage()];
}
return [
'status'=>'success',
'response'=>[
'domain'=>$domainInfo['data']['domain'],
'regdate'=>$domainInfo['data']['regdate'],
'expdate'=>$domainInfo['data']['expdate'],
'lockstatus'=>$domainInfo['data']['isTransferLock'],
'nameservers'=>[
'ns1'=>$domainInfo['data']['dns1'],
'ns2'=>$domainInfo['data']['dns2'],
'ns3'=>$domainInfo['data']['dns3'],
'ns4'=>$domainInfo['data']['dns4'],
'ns5'=>$domainInfo['data']['dns5'],
]
]
];
}
If an error is encountered while attempting to fetch the domain information, you should throw an exception. All exceptions will be caught by WHASOLS and the exception message displayed to the end user.