We have 14 guests online
   
PHP Scripts arrow Free PHP Tutorials arrow Free PHP Tutorials arrow PHP Tutorials and Examples arrow PHP 
Free PHP Tutorials arrow PHP Tutorials and Examples arrow PHP

URL Validation
User Rating: / 2
PoorBest 

Check that a URL or website address is valid using preg_match().

  1. <?php
  2.  
  3. $url = 'http://www.evilwalrus.org';
  4.  
  5. $urlValid = preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url);
  6.  
  7. if($urlValid) {
  8.     echo 'URL is valid!'// this will display
  9. } else {
  10.     echo 'Something is wrong with the URL';
  11. }
  12.  
  13. ?>

 

 

Directory Stats

There are 702 listing and 43 categories in our website

Change Language

Vegas Hotel
Free Ringtones
MySpace Images
Car Insurance
Debt