If you have an external script you want to call and need to include variables, then you need to add the following to your script:
Change anything with @@ @@
chdir('@@rootpathofdrupal@@');
require_once './includes/bootstrap.inc';
define('DRUPAL_ROOT', getcwd());
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
Once you have added the necessary information your will be able to get the same session variables.