Hola, les traigo un codigo que estuve viendo y me dio ideas para crear un codigo en php para saber si una web esta online u offline.
Then I leave the links and codes.
Kod:
<title> Web Online? [By SkarY]</title>
<?php
/*
Web Online? [Beta] By sKARy
Check if a Web server is online
*/
$page = htmlentities($_POST['page']);
$send = $_POST['send'];
if(isset($page) && !empty($page)){
function verify($url){
if(preg_match("/^(ftp|http|https):\/\/(.*)\.(.*)$/i", $url)){
echo fopen($url,'r') ? "<b>$url</b> is <font color='green'>Online</font>" : "<b>$url</b> is <font color='red'>Offline</font>";
}else{
echo '<u> URL not valid! </u><br>';
echo '
The format of a URL is valid: <br>
<b>
http://WWW.youweb.com <br>
http://yousite.es <br>
ftp://accounts.ftp </b>
';
}
}
verify($page);
}else{
if(isset($send)){
?>
<script>
alert("You must enter a URL!");
window.location=""</script>
<noscript>
<?die("You must enter a URL! <a href=''><b> Back! </b> </a>")?>
</noscript><?
}
?>
<form action="" method="POST">
URL: <input type="text" name="page" value="http://">
<input type="submit" name="send" value="Check!">
</form>
<?}?>
Link Versión Spanish: http://pastebin.com/8NvY6Z4b
Link Versión English: http://pastebin.com/ZNHKYL4D
I hope you learn.
Regards
#SkarY