There are various ways of checking if a given variable of website url is valid or not. However most of they try to get content of the webpage or ping it etc. The way that i prefer to use is by fopen command in a function or separately.
Use this code to confirm or verify that the given website address is valid and then do any further task as per your requirement
//checking if the site exists by fopen, instead of file_get_contents to speed it up
$url = “http://nabtron.com/”; //your url goes in this place instead of nabtron.com
if (@fopen($url,”r”)) {
echo “<b>”.$url.”</b> is accessible<br />”;
}
Thanks for sharing this articles
you’re welcome!
Great post! Would you mind if I use some of the information from your entry? I will provide a link back to your site, of course.
Sure! you’re welcome to do it (just don’t forget to link back :) )