I am wondering if this is a proper way to check, if a string contains nothing but an URL:
if (stripos($string, 'http') == 0 && !preg_match('/\s/',$string)) {
do_something();
}
stripos() checks if the string starts with "http"
preg_match() checks if the string contains spaces
If not so, I assume that the string is nothing but an URL - but is that assumption valid? Are there better ways to achieve this?