I used a file to go on numerous websites in order to check if a code is inside all of them.
I managed to go on all these websites, and by using curl, getting their contents.
I used foreach in order to ask the script to do an action for each of the websites.
Then, I used the function strpos in order to check it the code exists or not inside the script.
Unfortunately, the code somehow is unable to find the code, even though I know that it's inside the script.
Actually, thing is that it outputs good and bad outputs. Here's the code.
Code: Select all
<?php
set_time_limit(0);
$file_open = fopen("RedirectIds.csv","r");
$site_array = array();
while (!feof($file_open))
{
$line_of_text = fgetcsv($file_open, 1024);
$redirectId = $line_of_text[0];
if(is_numeric($line_of_text[0]))
$site_array["$redirectId"] = "http://**********/" . $redirectId . "." . "html"; //<<< the website is private matter, sorry.
}
foreach ($site_array as $redirectId => $site)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $site);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, True);
$site_content = curl_exec($curl);
curl_close($curl);
echo strpos(htmlentities($site_content), $redirectId) . ", ";
echo $redirectId;
if (strpos(htmlentities($site_content), $redirectId) != False)
echo $site . ", " . "true" . "<br />" ;
else
echo $site . ", " . "false" . "<br />" ;
}
fclose($file_open);
?>