SHARE
TWEET

Untitled

a guest Nov 20th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. function ozh_is_blacklisted( $url ) {
  4.  
  5.     $parsed = parse_url( $url );
  6.  
  7.     if( !isset( $parsed['host'] ) )
  8.         return 'malformed';
  9.  
  10.     // Remove www. from domain (but not from www.com)
  11.     $parsed['host'] = preg_replace( '/^www\.(.+\.)/i', '$1', $parsed['host'] );
  12.  
  13.     // The 3 major blacklists
  14.     $blacklists = array(
  15. //        'zen.spamhaus.org',
  16.   //      'multi.surbl.org',
  17. //      'black.uribl.com',
  18.         'dbl.spamhaus.org'
  19.     );
  20.  
  21.     // Check against each black list, exit if blacklisted
  22.     foreach( $blacklists as $blacklist ) {
  23.         $domain = $parsed['host'] . '.' . $blacklist . '.';
  24.         $record = dns_get_record( $domain );
  25. var_dump($record);
  26.         if( count( $record ) > 0 )
  27.             return 'listed';
  28.     }
  29.  
  30.     // All clear, probably not spam
  31.     return 'NOOOOOOOOOOO';
  32. }
  33. print_r($argv[1]);
  34. print ozh_is_blacklisted('http://'.$argv[1]);
  35. ~
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top