There are various ways of checking if a given variable of website url is valid or not. However most of they try to get
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 />”;
}