title: php script to search multiple webpages from file for specific word
body: <p>First excuse me for the bad english. </p>
  
  <p>I am trying to build a php script to search multiple webpages from a .txt file for specific word.</p>
  
  <p>More specific:</p>
  
  <p>I have a .txt file where i have stored many urls (every url is on one line, so if i have 10 urls the file have 10 lines) and i want the script to check the webpage content of each url for a specific word. So if the word is found on the webpage the script will return ONLINE othewise will return DOWN.</p>
  
  <p>I build the script but the problem is that it always return ONLINE even if the url from file doesn't have the specific word in it's webpage content.</p>
  
  <pre><code>&lt;?php  
  $allads = file("phpelist.txt");  
  print("Checking urls: &lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;strong&gt;");  
  for($index = 0; $index &lt;count($allads); $index++)  
  {  
  $allads[$index] = ereg_replace("\n", "", $allads[$index]);  
  $data = file_get_contents('$allads[$index]');  
  $regex = '/save/';  
  if (preg_match($regex, $data)) {  
  echo "$allads[$index]&lt;/strong&gt;...ONLINE&lt;br&gt;&lt;strong&gt;";  
  } else {  
  echo "$allads[$index]&lt;/strong&gt;...DOWN&lt;br&gt;&lt;strong&gt;";  
  }  
  }  
  print("&lt;/strong&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;I verified all urls from file!");  
  ?
  </code></pre>