youneek Posted May 3, 2007 Share Posted May 3, 2007 Can anyone help me figure out how to make this script run faster? <? if (!isset($domains)){ ?> <form method="post" action=""> <textarea name="domains" rows="10" cols="30"></textarea><br /> <input type="submit" value="Send"> </form> <? }else{ $domains = explode("\n", $_POST['domains']); foreach ( $domains as $addr ){ $url = "http://web.archive.org/web/*/http://".trim($addr, "\r"); $data = implode("", file($url)); preg_match_all ("/<p class=\"mainSearchTitle\">([^`]*?)<\/p>/", $data, $matches); foreach ($matches[0] as $match) { $match = strip_tags($match); echo trim(preg_replace("/ pages found for/", "", $match), " ")."<br />"; flush(); ob_flush(); } } } ?> Link to comment https://forums.phpfreaks.com/topic/49881-script-runs-slow-but-plenty-of-memory-on-server/ Share on other sites More sharing options...
corbin Posted May 3, 2007 Share Posted May 3, 2007 Since it's a remote file (or it looks like one) your script has to retrieve it and so on.... Plus, the server at the other end could be the slow one, or even if it's not slow, if your script is making a lot of requests to it, it could be slightly lagging a little. Link to comment https://forums.phpfreaks.com/topic/49881-script-runs-slow-but-plenty-of-memory-on-server/#findComment-244711 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.