Voting

: max(five, zero)?
(Example: nine)

The Note You're Voting On

Emmett Brosnan
13 years ago
Grabbing IPs for multiple hosts:

<?php
function getAddrByHost($hosts, $timeout = 3) {
$returnString = '';
foreach (
$hosts as $host) {
$query = `nslookup -timeout=$timeout -retry=1 $host`;
if (
preg_match('/\nAddress: (.*)\n/', $query, $matches))
$returnString .= trim($matches[1]) . '<br>';
$returnString .= $host . '<br>';
}
return
$returnString;

}

$hostArray[] = 'www.domain1.com';
$hostArray[] = 'www.domain2.com';
//$hostArray[] = 'www.domain3.com';
//$hostArray[] = 'www.domain4.com';

$returnString = getAddrByHost($hostArray);
echo
$returnString;
?>

<< Back to user notes page

To Top