This is a simple php example how to add http:// to the url.
function addhttp($url) { if (!preg_match("~^(?:f|ht)tps?://~i", $url)) { $url = "http://" . $url; } return $url; }
Recognizes ftp://, ftps://, http:// and https:// in a case insensitive way.