/ Published in: PHP
Want to know if a specific website is available? cURL is here to help. This script can be used with a cron job to monitor your websites.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php if (isDomainAvailible('http://www.css-tricks.com')) { echo "Up and running!"; } else { echo "Woops, nothing found there."; } //returns true, if domain is availible, false if not function isDomainAvailible($domain) { //check, if a valid url is provided { return false; } //initialize curl //get answer if ($response) return true; return false; } ?>
URL: http://css-tricks.com/snippets/php/check-if-website-is-available/