i am makeing a search engine and would like to know how i can check a web site address to make sure that it is up and running?
I have been trying with curl_* functions with no luck and google search didn't really help either
thanks for your time
Moderator: General Moderators
Code: Select all
<?
$connection=mysql_connect("localhost") or die("no connection dude");
mysql_select_db("something");
$result = mysql_query("SELECT Url FROM allurl");
$contenu = " ";
?>
<?
while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$first= strtolower($row["Url"]);
$fp = @fopen($first,"r");
if ($fp)
{
echo "$first ::: Exists!!!";
//below statement updates the table by inserting a no in the column error_404 and inserts a yes if is not found
$sql="update allurl set Error_404 ='No' where Url='$first'";
$connection_1=mysql_connect("localhost") or die("no connection dude");
mysql_select_db("something");
$sql_result = mysql_query($sql, $connection_1) or die("NOT ABLE TO EXECUTE QUERY !");
}
else
{
echo "$first ::: does not exist";
$sql="update allurl set Error_404 ='Yes' where Url='$first'";
$connection_1=mysql_connect("localhost") or die("no connection dude");
mysql_select_db("something");
$sql_result = mysql_query($sql, $connection_1) or die("NOT ABLE TO EXECUTE QUERY !");
}
}
mysql_free_result($result);
?>