\documentclass{article}
\usepackage{url}
\begin{document}
\section{Basic URLS}
Basic url: \url{http://example.com/~user} or \url|http://example.com/~user|.

Path url: \path{/foo/bar/baz} or \path|/foo/bar/baz|

\section{Verbatimness}
Special characters neutralized:
 \url{http://example.com/foo_bar},
 \url{http://example.com/foo#bar},
 \url{http://example.com/foo&bar}.

\def\baz{index.html}
And even though \verb|\baz| gives \baz;
\path{C:\foo\bar\baz}

OTOH, you get this: \url{http://example.com/\~{}user}

\section{Styles}
\DeclareUrlCommand\email{\urlstyle{sf}}

Email: \email{myself%node@gateway.net} or  \email|myself%node@gateway.net|.

\section{Defined urls}

\urldef{\myselfa}\url{myself%node@gateway.net}
\urldef{\myselfb}\email|myself%node@gateway.net|

Myself: \myselfa\ or \myselfb.

\section{Bracketting}
\DeclareUrlCommand\fancyurl{\def\UrlLeft{<url:\ }\def\UrlRight{>}\urlstyle{tt}}
Fancy url: \fancyurl{http://example.com/~user} or \fancyurl|http://example.com/~user|.

\end{document}
