Forum Moderators: coopster
If you want to check whether a site is up, you can use a function like this:
function site_is_up($domain)
{
if(@fsockopen ($domain, 80, $errno, $errstr, 1)===FALSE) return false;
return true;
}
If the site is always up but sometimes it takes registrations, sometimes not, you could use
file_get_contents($url) to retrieve the contents of the file and then search for a particular word that would indicate the page's status, e.g.
if(strpos(file_get_contents($url_to_check),'Registration now open')!==FALSE)
{
print "Registrations are now open";
}
if(site_is_up('www.myremotesite.com'))
{
print 'MyRemoteSite is available';
}
If there's always going to be a positive response from the server but registrations aren't necessarily going to be open, the second implementation will be necessary.