At 13:34 2004-07-18 -0700, Jeff Chan wrote:
On Sunday, July 18, 2004, 3:40:22 AM, Shashank Tripathi wrote:
I am looking for some simple PHP based functionality that will allow me to query the SURBL database for a domain name and confirm if it is a spamvertised one or not. Is there any engine for this?
I would like this functionality on hosted domains as well, which means setting up a DNS resolution etc may be impractical.
All I need is some online location to which I can send an input (a URL, or just the domain name) and get back a "YES" or a "NO" indicating whether this domain name is clean or not.
Wouldn't dns_get_record() in PHP, specifically the DNS_A option resolve domains?
Just a note since I've been down this road myself:
dns_get_record is PHP 5 only*, which was in beta until last week. Many installations will probably stay with 4.x until 5.1 is released.
If you only want to check the existence of an A record, with 4.x, you can use checkdnsrr instead. http://us2.php.net/manual/en/function.checkdnsrr.php
You can not get TXT records with checkdnsrr though, so if you want check those as well under PHP 4.x (multi.surbl.org is more interesting if you do...), you have to use work-arounds, like directly calling exec nslookup.
I have a 4.x php script that I use that's quite ugly, but works for me - if anyone is interested in it just let me know and I'll pass it on.
*) There is a back-port of dns_get_record for PHP 4.x. It didn't work for me. Others might be more lucky...
Patrik