Advertisement
carbonize

SFS Check

Jun 6th, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.25 KB | None | 0 0
  1. function SFSCheck($ip, $email = '')
  2. {
  3.   ini_set('default_socket_timeout',15);
  4.   $email = (!empty($email)) ? '&email=' . urlencode($email) : '';
  5.   $SFSurl = 'http://www.stopforumspam.com';
  6.   $SFSget = '/api?ip=' . $ip . $email . '&f=serial';
  7.   if(ini_get('allow_url_fopen') == 1)
  8.   {
  9.     $SFSdata = @file_get_contents($SFSurl . $SFSget);
  10.   }
  11.   else
  12.   {
  13.     $fp = @fsockopen("www.stopforumspam.com", 80);
  14.     if($fp)
  15.     {
  16.       $out  = "GET " . $SFSget . " HTTP/1.0\r\n";
  17.       $out .= "Host: www.stopforumspam.com\r\n";
  18.       $out .= "Connection: Close\r\n\r\n";
  19.       fwrite($fp, $out);
  20.       while (!feof($fp))
  21.       {
  22.         $foo = fgets($fp);
  23.         if(strpos($foo, 'a:') === 0)
  24.         {
  25.           $SFSdata = $foo;
  26.         }
  27.       }
  28.     }
  29.     else
  30.     {
  31.       $SFSdata = false;
  32.     }
  33.   }
  34.   if($SFSdata === false)
  35.   {
  36.     return false;
  37.   }
  38.   else
  39.   {
  40.     $SFSdata = @unserialize($SFSdata);
  41.     if($SFSdata !== false)
  42.     {
  43.       if(isset($SFSdata['ip']['confidence']))
  44.       {
  45.         // Do what you want to do with the ip confidence level
  46.       }
  47.       if(isset($SFSdata['email']['confidence']))
  48.       {
  49.         // Do whatever you want to do if there is an email confidence score
  50.       }
  51.     }
  52.   }
  53.   return false;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement