I'm trying to encode a URL and pass it in a query string (I know there are better ways of performing this, but this is a must in my situation. Just pretend it is out of my control.)
[PHP]<?php
$url = 'http://example.com?pid=12&uid=200' echo 'http://test.com?url='.urlencode($url);
?>[/PHP]
The resulting URL is invalid as
because urlencode() doesn't seem to work. Neither does rawurlencode(). What am I supposed to use to produce this:
http://test.com?url=http%3A%2F%2Fexample.com%3Fpid%3D12%26uid%3D200