I'm looking to use a compression algorithm to store the target URL of a redirection script.

e.g., click.php?url=(compressed string)

Are there any compression functions that would give URL-friendly output? i.e. Output without any dangerous special characters; output that could be passed without fear of corruption when decompressing the $_GET value.

(and preferably functions that are available in PHP 4.3.1)