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);
?>

5 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

  2. mega 888

    Extra flab optimized components in all your published
    developing. It doesn’t increase the chances of you being displayed.
    They likewise have a good content of potassium.

  3. mega 888

    Extra flab optimized components in all your published developing.
    It doesn’t increase the chances of you being displayed. They
    likewise have a good content of potassium.

Leave a Reply