I am trying to verify URLs. This is the code I have:
function isValidURL($url)
{
return preg_match('|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i', $url);
}
This code is working but now I am trying to work out how to add http:// or https:// if the URL is correct but is just missing the beginning http://
Please point me in the right direction.