Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 1st, 2012  |  syntax: PHP  |  size: 0.62 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. set_time_limit(0);
  4.  
  5. $url = array_map("trim", file("unchecked.txt"));
  6.  
  7. $ok = array();
  8. $notok = array();
  9.  
  10. for ($i = 0; $i < count($url); $i++) {
  11.  
  12.     $ch = curl_init();
  13.     curl_setopt($ch, CURLOPT_URL, $url[$i]);
  14.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  15.     curl_exec($ch);
  16.  
  17.     if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == "200") {
  18.         array_push($ok, $url[$i]);
  19.     } else {
  20.         array_push($notok, $url[$i]);
  21.     }
  22. }
  23.  
  24. $fo = fopen("ok.txt", "w");
  25. fwrite($fo, implode("\n", $ok));
  26. fclose($fo);
  27. $fo = fopen("notok.txt", "w");
  28. fwrite($fo, implode("\n", $notok));
  29. fclose($fo);
  30. ?>