Validate URL in PHP

By | March 8, 2011

To validate url at server side use this function.
In this function $variable defines the your string which you want to validate.

<?php 
$reg_exp = /(http?://)?([da-z.-]+).([a-z.]{2,6})([/w ?=.-]*)*/?$/
ereg($reg_exp,$variable);
?>

3 thoughts on “Validate URL in PHP

  1. prabhat

    this code work in my url validation . i want a variable which can check email validation in php . using ereg function

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *