I have been assigned a project to create a RBL Check Tool. I have successfully completed phase I where the loop runs on the URLs.txt and produces the correct results for the $ip. The problem I am having is converting $ip from a single entry(the ip address) to a .TXT file that holds 5 ip addresses. So when the page loads, it will get the first ip address in the IPs.txt file and run through all of the domains in the URLs.txt file, then loop back to the IPs.txt file and get the second ip address from IPs.txt and loop through the URLs.txt and this loop function would occur until all 5 ip addresses have processed. Then the Lookups will be written to the Results.csv. Please help as I am coming close to the project deadline. Thanks in advance for assistance with Phase II!!!
Here is my Phase I functional code:
<?php
echo "<b>Checking RBLs</b><br /><br />";
set_time_limit(0);
$ip = '000.000.000.000';
if (($handle = fopen("csv/URLs.txt", "r")) !== false)
{
while (($data = fgetcsv($handle, 100, ",")) !== false)
{
$num = count($data);
for ($c = 0; $c < $num; $c++)
$rbl = $data[$c];
{
$rev = array_reverse(explode('.', $ip));
$lookup = implode('.', $rev) . '.' . $rbl;
if ($lookup != gethostbyname($lookup))
{
$putToCSV = fopen('csv/results.csv', 'a');
$date = "" . date('d') . "-" . date('m') . "-" . date('Y') . "\r\n";
fwrite($putToCSV, "$ip,$rbl,$date");
fclose($putToCSV);
}
}
}
}
fclose($handle);
set_time_limit(30);
echo "<br /><br /><b>Finished</b><br /><br />";
?>
(Added [noparse]
[/noparse] tags around code -- MOD)[/i]