PHP to return gethostbyname($lookup) value
<p>I am using the code below (simplified version) to determine if my IPs are on a blacklist. I need to modify it to be able to determine if an IP is on a Whitelist. The function will require me to see a specific code returned.</p>

<pre><code>127.0.0.1 
127.0.0.2 
127.0.0.3 
127.0.0.4 
127.0.0.5
</code></pre>

<p>How can this be adjusted to return the (code) output value when the script runs?</p>

<pre><code>$host = '222.22.222.222';
$rbl  = 'hostkarma.junkemailfilter.com';
$rev = array_reverse(explode('.', $host));
$lookup = implode('.', $rev) . '.' . $rbl;
if ($lookup != gethostbyname($lookup)) {

   echo "ip: $host is listed in $rbl\n";
} else {
   echo "ip: $host NOT listed in $rbl\n";
}
</code></pre>

<p>EDIT:  Sorry guys, The function of the script above will return confirmation if the IP address is on the blacklist entered in $rlb. However, Hostkarma returns a code, one of the 127.0 codes shown above as each code indicates a different block status. I need to get the code. "echo $lookup;" just returns the reverse lookup, like this: 222.222.22.222.hostkarma.junkemailfilter.com</p>
