My application does the following:
Takes a string and encrypts it. This means it contains characters lower than 32 and hence unprintable.
rawurlencode()s it, and appends it to a URL to make a querystring/GET request.
I send this off as a CURL command:
$cl = curl_init();
curl_setopt ($cl, CURLOPT_URL, $getURL);
curl_setopt ($cl, CURLOPT_HEADER, 1);
curl_setopt ($cl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($cl, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt ($cl, CURLOPT_TIMEOUT, 120);
$result = curl_exec ($cl);
On the other page which is the target of the URL, I check the appropriate GET variable to retrieve this value. The problem is that whereever the original encrypted and rawurlencoded string contained %00 (ie. ascii character zero), the GET variable now contains \0 (ie. 2 characters showing the C escape-code representation of character zero). In turn, this means that decrypting this string will not work as it has been altered from the original. Rawurldecoding this string doesn't change the "\0" back to "%00", either.
What is likely to be the cause of this, and how can I get around or fix it?