What is the best way to find if a string contains a url?
I'm writing a chatbox and need to deny the posting of urls in it...
if(preg_match('/[a-zA-Z]+:\/\/[0-9a-zA-Z;.\/?:@=_#&%~,+$]+/', $clean_message, $matches))
{
die('INVALID!');
}
seems to do the trick for urls that contain http:// but i need to also be able to deny urls such as youtube.com and if an ipaddress is posted etc..
I need to keep the chatbox clean from users spamming urls!