HuntsvilleMan Posted December 5, 2011 Share Posted December 5, 2011 I need help getting global persistence variables in a set of php programs that interact like the ones shown below: |------ -----| \ / | Start.php --->Callback.php----> message.php --> | / \ \ / | Remote vendor service---| At present I pass all parameters to startcall.php and it in turn it passes the values as URL parameters to other programs. The problem I have is that the remote vendor request I make truncates long URLs before they come back. They tell me it has something to do with the way URLs get encoded (a chunking issue) and they can’t fix it. To shorten up the URLs I need to find a way to make all parameters I send to start.php become persistent for about 3 minutes and be avaiable to all PHP programs. Session variables don’t seem to be quite what I need so far as I understand. For example, they would be fine to let start.php remember but then the other programs don’t have the values needed. So far the only solution I know of would be for start.php to store all values in a database table and then have the other programs recall the data as needed. Is there a simpler way to get the kind of global persistent variables I need in this php application? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/252529-how-do-i-get-global-persistent-variables-in-php/ Share on other sites More sharing options...
ialsoagree Posted December 5, 2011 Share Posted December 5, 2011 Variables are in RAM memory while a script is running on your local server. They will become unaccessible as soon as your script stops running (IE. the http request was fulfilled) and they are never accessible by remote servers. If the issue is passing information on to another vendor, how does their API work exactly? You could provide the information to them via XML, that's what XML is intended for. Alternatively, if XML is not an option due to their API, you might consider building a POST request to send to them. Quote Link to comment https://forums.phpfreaks.com/topic/252529-how-do-i-get-global-persistent-variables-in-php/#findComment-1294721 Share on other sites More sharing options...
xyph Posted December 5, 2011 Share Posted December 5, 2011 You need to use a form of external storage to make data persistent. Store the data in a flat file or database with an expire time you can check. You probably also want some form of garbage collector that checks for expired entries at intervals. Quote Link to comment https://forums.phpfreaks.com/topic/252529-how-do-i-get-global-persistent-variables-in-php/#findComment-1294723 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.