Errors with urlencode and gzcompress
| From: | James Crow | Date: | Tue, 04 Dec 2007 19:14:56 +0000 |
| Subject: | Errors with urlencode and gzcompress | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-28615@lists.php.net to get a copy of this message | ||
Hello all,
I am having some trouble figuring out how to pass data to a remote PHP
script.
Here is the scenario:
I have several Windows boxes running Apache 2 and PHP 4. PHP5 is not an
option because of some Zend Encoded scripts that we purchased. I need to
pass data from one script to a remote script. The local script has an
array that is serialized. Then the serialized string is then double
urlencoded. A single urlencode does not work correctly on PHP4/Win32.
The serialized and urlencoded string is then passed in the request to a
remote script: http://192.168.1.2?data=<serialized string>
This process works fine for small amounts of data. If the URL is below a
certain limit (maybe 1024 characters, have not yet found the exact size
limit) this works fine.
I now have a need to pass more data to the remote script. I have tried
to do
$temp = array ('lots of data...');
$temp1 = serialize($temp);
$temp2 = gzcompress($temp1); //compress our string first to save space
$temp3 = urlencode($temp2);
$data = urlencode($temp3);
http://192.168.1.1/?data=$data
Sometimes this works and sometimes not. I have not yet been able to
figure out why this sometimes fails.
Can anyone tell me why this works sometimes and others not? Or can
someone suggest a better way of passing data to a remote script.
Thanks,
James