You are here

function shurly_host_is_resolveable in ShURLy 8

Same name and namespace in other branches
  1. 6 shurly.module \shurly_host_is_resolveable()
  2. 7 shurly.module \shurly_host_is_resolveable()

Check whether the input $hostname can be resolved to a valid IP address.

Parameters

string $hostname: Hostname to test.

Return value

bool TRUE if the $hostname resolves to a valid IP address; otherwise FALSE.

1 call to shurly_host_is_resolveable()
shurly_validate_long in ./shurly.module
Validate a long URL.

File

./shurly.module, line 705
Description http://www.youtube.com/watch?v=Qo7qoonzTCE.

Code

function shurly_host_is_resolveable($hostname) {
  if (_shurly_is_ip_address($hostname)) {
    return TRUE;
  }
  elseif (_shurly_is_ip_address(_shurly_gethostbyname($hostname))) {
    return TRUE;
  }
  return FALSE;
}