在PHP中执行GET时,URL会截断特殊字符

I have this domain

https://test.com/?url=https://google.com/search?q=#ie7&rls=login.microsoft:en-US:IE-Address&ie=&oe=#

And this is the code:

<?php
 //check if the url parameter exists 
 if(isset($_GET['url'])) $url=$_GET['url'];
 else $url=FALSE;
?>

If I use this in the html
<?=(!$url) ? '' : $url ?>

I get an output that cuts off in special characters like # or & etc.. and becomes like this for example https://google.com/search?q=# I tried urlencode/decode but couldn't figure it out

if you need all after ?url=, you can try this:

$url = $_SERVER['REQUEST_URI'];  
$url2 = substr($url, strpos($url, '?url')+5);
$url = substr($url, strpos($url, '?url'));  
print($url); // url?=https://..etc
print($url2); // https://..etc  

you want to output the full domain just after

https://test.com/?url=

to the end, and get https://google.com/search?q=#ie7&rls=login.microsoft:en-US:IE-Address&ie=&oe=# right?

So if this is fixed, you can do:

echo substr($url, 22);