php – Escaping & in GET-ThrowExceptions

Exception or error:

I have this link:




should be


but when i try

print $_GET["url"]; 

it only prints /

The problem it’s obviously with & char, i tried htmlspecialchars($_GET["url"]) with no luck.
What can i do to have the entire string?

How to solve:

I don’t know where did you get the target url, but try encode it before you print it in the get.
i.e encodeURIComponent function in JS, rawurlencode in PHP, or just use this ref here to replace any html chars you want. And rawurldecode it after $_GET['url'].


To get the full request you’ll have to use $_SERVER['QUERY_STRING'];

eg :



Nope that is because the other two params are different.

You need to get each of them separately. like $_GET['id'], $_GET['authkey']

or you could just make use of a foreach construct.

foreach($_GET as $k=>$v)

echo $myparams['authkey'];// "prints" 234234324242342

Leave a Reply

Your email address will not be published. Required fields are marked *