Originally suggesting to use CURL, I now believe that it might not be the best solution. If you're simply looking to preserve or pass data between scripts, you might want to look into Sessions, which allow you to set and preserve data between scripts.
eg:
Script 1
session_start();
$_SESSION['userName'] = $username;
Script 2
session_start();
if (isset($_SESSION['userName']))
$username = $_SESSION['userName'];
echo $username;
This will successfully pass the value of $username between two scripts. Simply put any variables into the $_SESSION array and they will be available throughout your scripts.
- Be sure to include session_start(); at the top of every script
- Look at also including session_set_cookie_params() to be sure your sessions are available through your domain and/or don't conflict with other site's sessions.