this script will detect URLs in a string and automatically create a link to this URL.
it removes the query-string and shows only the top-level of the site linked to as text.

download options for string handling / autolink

you can download the source as PHP file,

open the file as plain text in a new window or

get the code in a textarea to copy it.