I found this pretty hard to begin with I was uncertain of how to check whether a website was online without writing a complicated string of Regular Express and even then this didn’t check if the site was active at that point in time. The solution was supprisingly simple:
We can use the PHP Function “fsockopen” to check that a the port is open on the appropriate hostname (website address).
$urlExists = @fsockopen($siteurl,80);
if($urlExists) {
// do something
} else {
// show an error
}
Simply pass in the Site URL Variable.
No Comments Yet!