Monthly Archives: March 2011

Validate URL in PHP

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