How to check if IP adress is spammer [PHP]

We will check how to get information about IP using stopforumspam.com API. This can help stop harmfull servers do harm to your website.

  1. Add this code to your your PHP application, where you will check for spammers:
$ipadresstocheck = '198.40.54.178';
$get = file_get_contents('https://www.stopforumspam.com/api?ip='.$ipadresstocheck.'&confidence');
$arr = simplexml_load_string($get);
$ipappearsinspamdatabase = $arr->appears;
$lastseeninspamdatabase = $arr->lastseen;
$sfsconfidence = $arr->confidence;
  • Use $ipappearsinspammersdatabase¬†variable to check if IP adress appears in stopforumspam.com database.
  • Use $lastseeninspamdatabase variable to check when ip adress is last seen in database.
  • Use $sfsconfidence to get confidence scoring. Confidence scoring is statistically calculated score, based on the last seen date and the number of sightings.

More information about stopforumspam.com API usage.