$con = mysql_connect("localhost", "seanstar", "");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db("seanstar_urls",$con);
$SQL = mysql_query("SELECT url FROM urls",$con);
$mh = curl_multi_init();
$handles = array();
while($resultSet = mysql_fetch_array($SQL)){
$ch = curl_init($resultSet['url']);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_NOBODY, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_multi_add_handle($mh, $ch);
$handles[] = $ch;
}
$running = null;
$result = curl_multi_exec($mh,$running);
if (strstr($result, "404") != FALSE) {
echo "It is 404.<br>";
} else {
echo "It is not 404.<br>";
}
foreach($handles as $ch)
{
curl_multi_remove_handle($mh, $ch);
}
curl_multi_close($mh);
I need it to spit out if each url in the table url is 404 or not. Any help? What I tried does not work!


Sign In
Create Account


Back to top









