Pages

5/25/2011

Using Drupal Session Variables outside of Drupal

Drupal stores session variables a bit differently then normal php applications, so some integration is required.

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.

No comments:

Post a Comment