I want to validate URL in PHP but the function should accept the URL even if http:// or https:// not present in the input.
Following URL's should be acceptable:
http://example.com
http://www.example.com
https://example.com
https://www.example.com
www.example.com
example.com
It should not accept ftp protocol, IP address, Port, URL path, query, or fragment.