• Welcome to Simple Machines Community Forum. Please login or sign up.



Attempts to get the hostname from an IP address.


string host_from_ip (string $ip)

Parameter $ip

Expected type: String
Description: An IP address to get the hostname for

Return value

Expected type: String
Description: Returns the hostname for the given IP (or false if it couldn't be found)


  • Attempts to use shell_exec first since you can set timeout limits that way
  • Determines what command to send based on whether or not you're on a Windows host (nslookup for Windows or host for others)
  • shell_exec usage is random depending on the outcome of rand(0,1)
  • Sets the "host_to_dis" setting to 1 if the "-W" option on the host command returns "invalid option"
  • Uses gethostbyaddr as a last resort