The "simplest" way would be to use regular expressions because thay let you check for:
'either http://www or www' followed by a dot, followed by 'some text', followed by a dot, followed by 'some text of 2 or 3 characters'
Check out the PHP manual for more info.
Also, search for regular expressions on PERL websites, because they have TONS of info about it.
off the topmof my head it would be something like this: (feel free to correct me regexp dudes!)
if (preg_match("/[http:\/\/www,www].[a-z,A-Z,0-9]*.[a-z,A-Z]{2,3}/",$URL))
{
it matched
};