title: How to pass URL in URL (as GET parameter) using PHP?
body: <p>I'm having some problems passing URL's as GET parameter. When I try to access:</p>
  
  <p><a href="http://www.linkebuy.com.br/linkebuy/parceiro?url=http%3A%2F%2Fwww.google.com" rel="noreferrer">http://www.linkebuy.com.br/linkebuy/parceiro?url=http%3A%2F%2Fwww.google.com</a> </p>
  
  <p>I get the following message:</p>
  
  <p><img src="https://i.stack.imgur.com/Sv5Bw.png" alt="Unexpected error."></p>
  
  <p>However, if I go for:</p>
  
  <p><a href="http://www.linkebuy.com.br/linkebuy/parceiro?url=123" rel="noreferrer">http://www.linkebuy.com.br/linkebuy/parceiro?url=123</a></p>
  
  <p>Everything works just fine (it redirects to an inexistent site - 123 -, of course, but it does the expected). By elimination I can say there's something wrong with the <code>url</code> parameter, but what is it?</p>
  
  <p><strong>OBS:</strong> I'm using <code>rawurlencode()</code> to encode the URL.</p>
  
  <p><strong>EDIT:</strong> <em>Code you asked...</em></p>
  
  <p>In the first view, where the link is (<a href="http://www.linkebuy.com.br/notebook/detalhe?id=5" rel="noreferrer">http://www.linkebuy.com.br/notebook/detalhe?id=5</a>):</p>
  
  <pre><code>&lt;!-- url() function just completes the right URL (production or development) --&gt;
  &lt;a href="&lt;?php echo url('linkebuy/parceiro/?url=' . rawurlencode($l-&gt;getUrl()), true) ?&gt;" class="&lt;?php echo $leadClass ?&gt; oferta" target="_blank"&gt;
      &lt;?php echo $l-&gt;getNomeFantasia() ?&gt;
  &lt;/a&gt;
  </code></pre>
  
  <p>When clicked the link redirects to an action (<code>/linkebuy/parceiro</code>), where happens the following (basicly nothing, just keeping in the framework):</p>
  
  <pre><code>public function execute($request, $response) {
      $response-&gt;addParameter('url', rawurldecode($request-&gt;getParameter('url', ''))); //This creates $url in the view
      $response-&gt;setTemplate('site/linkebuy/lead-parceiro.php'); //Forwards to the view
  }
  </code></pre>
  
  <p>It includes the view, <code>lead-parceiro.php</code> (above on the question, I link to this page), where the head contains:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      setInterval(function(){ window.location = '&lt;?php echo $url ?&gt;'; },3000);
  &lt;/script&gt;
  </code></pre>