Re: Re: Posting variables from one php script to another

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jasper Bryant-Greene wrote:
Al wrote:

I'd use this. It's simple and doesn't involve CURL. Here is a brief outline.

$file_str= base64encode(serialize($_GET));  //$_GET can be any array


Any reason why you base64_encode here? fwrite is binary-safe so base64 encoding your data is slow and a waste of space.

Create a temporary file and write your string

fwrite($temp, $file_str);

fetch your data with

$saved_get= unserialize(base64decode(file_get_contents(filename));

Unlink your file when done with it.


Rather than resort to the slow process of creating, writing, reading and deleting a file for every request (not to mention generating a unique ID to prevent collisions with simultaneous requests), I'd be more tempted to find out exactly why the OP couldn't get it working with GET variables.

Perhaps he could post some more code, as I regularly pass GET variables to PHP scripts through <img> tags and the like with no problems whatsoever.


Serializing has problems with quotes, backslashs, etc.  base64 makes it foolproof.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux