Zend - The PHP Company




Authentication

Add Code


Site Online  

Type: code fragment
Added by: fireuk
Entered: 01/06/2005
Last modified: 02/12/2005
Rating: - (fewer than 3 votes)
Views: 3081
Test if site is online with customer error message.


<?php

//onlineCheck("www.google.com", "This site is online", "This site is NOT online");

function onlineCheck($url$good$bad) {
$url str_replace("http://"""$url);
$url str_replace("https://"""$url);
$fp = @fsockopen($url80);
if (!
$fp) {
return 
$bad;
} else {
fclose($fp);
return 
$good;
}

?> 


Usage Example




Rate This Script





Search



This Category All Categories