I am trying to keep the username variable alive while I redirect to foursquare for oauth purposes. I am using Amazon EC2 servers. Here is the relevant code:
session_start();
if (isset($_GET['username']))
{
$_SESSION['username'] = $_GET['username']
header("Location: https://foursquare.com/oauth2/authenticate?clientid=(clientidHere)&responsetype=code&redirect_uri=http://redirecturi");
}
if (isset($_GET['code']))
{
echo $_SESSION['username'];
}
I found that I just had to use cookies.