
Untitled
By: a guest on
Jun 1st, 2012 | syntax:
PHP | size: 0.62 KB | hits: 19 | expires: Never
<?php
set_time_limit(0);
$url = array_map("trim", file("unchecked.txt"));
$ok = array();
$notok = array();
for ($i = 0; $i < count($url); $i++) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url[$i]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_HTTP_CODE) == "200") {
array_push($ok, $url[$i]);
} else {
array_push($notok, $url[$i]);
}
}
$fo = fopen("ok.txt", "w");
fwrite($fo, implode("\n", $ok));
fclose($fo);
$fo = fopen("notok.txt", "w");
fwrite($fo, implode("\n", $notok));
fclose($fo);
?>