title: Better way to validate a URL in PHP
body: <p>I've been reading various posts on Stack Overflow to try and find an ideal way to validate a URL in PHP.  My research has come up with three possible solutions, however, none of them are ideal.  </p>
  
  <p>The three methods mentioned are regex, <code>filter_var ($url, FILTER_VALIDATE_URL)</code> and <code>parse_url ()</code>.  The problems with the first approach are already well known, and the most comprehensive validation regex I could find spanned pages.  The filter_var function built into the PHP filtering extension appears to have faults, such as treating a url like http://... as valid.  The parse_url method is using a function that was never intended for URL validation and therefore can't be depended on for this task.  </p>
  
  <p>Are there any other options regarding URL validation in PHP that I may have missed?  </p>