Yang Li Ke wrote:
I have this script which checks multiple domains for a link back to my site:
function backlinkCheck($siteurl, $recip) {
$arrText = @file($siteurl);
for ($i=0; $i<count($arrText); $i++) {
$text = $text . $arrText[$i];
}
if (eregi($recip, $text)) {
return true;
} else {
return false;
}
}
The problem is that It displays true or false only after it went through the
whole list.
Id like it to display each site after they are done. Anyone can tell me how
to do this?
--
Yang
This should work as long as $recip will always be on one line, which should be
the case if you're just looking for your domain.
function backlinkCheck($siteurl, $recip) {
$arrText = @file($siteurl);
foreach ($arrText as $text) {
if (eregi($recip, $text))
return true;
}
return false;
}
You also might want to look up foreach, join(), and the ".=" operator for the
future. They aren't needed here any more, but could have made your code a bit
more efficient/readable. You might also want to add some error handling (try
entering a bogus url and see what happens).
Regards,
Shawn
--
Shawn Wilson
sh***@glassgiant.com http://www.glassgiant.com