How can I verify whether the website is correct? The URL format is www.abc.comabc.comwww.abc.comabc.comwww.abc.comswww.abc.comsswww.abc.comsxx.htm www. abc. comsxx. p. how can I verify whether the URL is correct?
The URL format is as follows:
Http://www.abc.com
Http://abc.com
Http://www.abc.com/
Http://abc.com
Http://www.abc.com/s/
Http://www.abc.com/s/s/
Http://www.abc.com/s/xx.htm
Http://www.abc.com/s/xx.php
Http://www.abc.com/s/xx.asp/
Https://www.abc.com/s/xx
Ftp://www.abc.com/
And so on.
If (preg_match ("/????????????????? // ", $ Url) {// How do I write it here? What are the possible URL formats?
Echo "the website is correct ";
} Else {
Echo "website error ";
}
------ Solution --------------------
"/(Http :\/\/)? W {3} \. [^/.] + \. (com | net | cn | org). (cn )? /I"
------ Solution --------------------
/^ [A-zA-Z] +: \/. +/I