Jump to content

Checking a url format


graham23s

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/112175-checking-a-url-format/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.