jasonc Posted September 23, 2010 Share Posted September 23, 2010 I wish to find a way to test if multiple sites are up or not. I have been using get_headers but it seems that this does not do what I thought I would. I wish to know if the sites are down or not. Is there another function that can test what state the site is in. i.e. server not found, server issues prevented the page from showing... Using get_headers will still show the site is live even if the server is not found, due to server problems, if any. Quote Link to comment Share on other sites More sharing options...
petroz Posted September 23, 2010 Share Posted September 23, 2010 With get headers, you can check the server's response code. And that would tell you if a site is up or not.. For example.. <?php $url = 'http://google.com'; $status = get_headers($url); if(strstr($status[0], '200')) { echo "Site Up"; } else { echo "Site Down"; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.