This might be a URL issue not a language issue. In Perl you can
use URI::Escape;
If you have the module installed
then you can do this
$link_for_html_page = uri_escape($raw_url);
To give a link for an outgoing HTML page.
or
$link_for_get_function = uri_unescape($coming_from_html_page);
To give you a valid URL for your get function.
Is there something similar in PHP?