graham23s Posted June 27, 2008 Share Posted June 27, 2008 Hi Guys, i was wondering if there was a better way to check a url format than the one i made: <?php // check the url format if (!preg_match("/^http:/", "$var_url")) { $errors[] = "Your URL looks invalid, does it start with http://"; } ?> as you can see its basic lol thanks guys Graham Quote Link to comment Share on other sites More sharing options...
anthrt Posted June 27, 2008 Share Posted June 27, 2008 <?php $check = substr($url, 0, 7); if($check != 'http://') { $errors[] = "Your URL looks invalid, does it start with http://"; } ?> Quote Link to comment Share on other sites More sharing options...
Rowno Posted June 27, 2008 Share Posted June 27, 2008 An easier way would be to use: checkdnsrr($domain, "ANY") if you want to check if a domain exists or not. 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.