Something like (untested):

php banips.php
PHP Code:
$ips file("ips.txt");
foreach (
$ips as $ip) {
    
$cmd "iptables -A INPUT -s $ip -j DROP";
    echo 
"$cmd\n";
    
system($cmd);

Edit: to constantly do this, simply make a endless loop around it and start it in a root screen session. Your home work.