I don't know much about php (I understand programming in general but don't know php syntax). I need to pass variables from one php script to another (on different domain). Esentially, some variables will be returned to my first script from PayPal IPN, and that first php script will decide to what web site php script to send data passed from PayPal. I'll figure out how to if statements or loops, if necessary, but I need to know how the syntax look for passing data to second script.
Let say first php script is called first.php, and variables "value" and "price" are passed from paypal to first.php (first.php is on server datafirst.com). Now I need to pass those same variables to datasecond.com php script called second.php).
How would the syntax for sending data look like in first.php?
Passing variables between PHP scripts
Moderator: General Moderators
Re: Passing variables between PHP scripts
There are several ways to pass variables between PHP scripts. Sometimes one is more appropriate to use than another.
- The GET method passes name-value pairs as part of the URL string. See http://php.net/manual/en/reserved.variables.get.php.
- The POST method passes name-value pairs as a separate array, not visible to users. See http://php.net/manual/en/reserved.variables.post.php.
- You can set Session Variables that can be read by subsequent scripts in the same online session. Note that every script must first use the PHP command session_start() at the very beginning of the script. See http://php.net/manual/en/features.sessions.php