Trying to query spamhaus.org for blacklisted ip. An example is 69.35.160.59
If I go to https://www.spamhaus.org/lookup/ and enter it, it shows on blacklist same with 112.198.83.17, however the following code returns an empty array.
I print out the url and it looks correctly formatted in reverse ip
17.83.198.112.zen.spamhaus.org.
Any ideas?
<?php
$ip = "112.198.83.17";
$blacklist = "zen.spamhaus.org";
$url = implode(".", array_reverse(explode(".", $ip))) . ".". $blacklist;
echo "$url<br>";
$record = dns_get_record($url);
print_r ($record);
?>
You doing right. See here for result codes http://www.spamhaus.org/faq/section/DNSBL%20Usage#366
Here is my output for ip 69.35.160.59
Array (
[0] => Array
(
[host] => 59.160.35.69.zen.spamhaus.org
[type] => A
[ip] => 127.0.0.4
[class] => IN
[ttl] => 900
)
[1] => Array
(
[host] => 59.160.35.69.zen.spamhaus.org
[type] => TXT
[txt] => http://www.spamhaus.org/query/bl?ip=69.35.160.59
[entries] => Array
(
[0] => http://www.spamhaus.org/query/bl?ip=69.35.160.59
)
[class] => IN
[ttl] => 900
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With