title: Request url on a save way
body: <p>I would like to read a url. <code>www.domain.com?cookie=set&amp;redirect=yes</code></p>
  
  <p>Now I want to use <code>$ _SERVER['REQUEST_URI']</code> but this does not work with <code>strip_tags</code> and <code>htmlspecialchars</code>. </p>
  
  <p>Also many I read that you should watch for XSS.</p>
  
  <p>Does anyone know how to save a URL can be used by GET?</p>
  
  <pre><code>$url = "http://'.$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI];
  $url = strip_tags($url);//doesnt work
  $url = htmlspecialchars($url);//doesnt work
  </code></pre>
  
  <p>Thanks!</p>
  
  <p>Edit to (doesnt work):</p>
  
  <pre><code>$url = "http://".$_SERVER[HTTP_HOST]."".$_SERVER[REQUEST_URI];
  $url = strip_tags($url);
  echo $url;
  </code></pre>
  
  <p>for example 
  www.domain.com?cookie=set&amp;re<b>d</b>irect=yes </p>
  
  <p>output => index.php?cookie=se%3Cscript%3Et&amp;re%3Cb%3Ed%3C/b%3Eirect=yes</p>