Jump to content

Help with foreach loop


youneek

Recommended Posts

I wrote a script to help figure out an archive.org score. It is supposed to lookup muliple domains, but isn't working. It's only doing one. Can somebody help?

 

<?
if (!isset($_GET["domains"])){
?>
<form method="GET" action="">
<textarea name="domains" rows="10" cols="30"></textarea><br />
<input type="submit" name="send" value="Send">
</form>
<?
}else{
$domains = explode("\n", $_GET['domains']);
foreach ($domains as $addr){
$url = "http://web.archive.org/web/*/http://".$addr;
$data = implode("", file($url));
preg_match_all ("/<p class=\"mainSearchTitle\">([^`]*?)<\/p>/", $data, $matches);
foreach ($matches[0] as $match) {
$match = strip_tags($match);
echo $match."<br />";
	}
}
}
?>

Link to comment
https://forums.phpfreaks.com/topic/47659-help-with-foreach-loop/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.