Voting

: max(two, six)?
(Example: nine)

The Note You're Voting On

gabriel at nexcore dot com dot br
8 years ago
For the "dig" solution, here is a better one:

<?php
$IP
= `/usr/bin/dig $host. A +short | /usr/bin/tail -n1`
?>

Using tail because dig, even in the +short form, may return CNAME entries first, and also may return many, many entries (see "dig google.com").

Usig the dot at the end of the host to not perform domain searches.

This works also when $host = IP address already

Will return empty string in case o resolve failure (invalid hostname)

<< Back to user notes page

To Top