PHP

Access Drupal functions and session from a PHP script in a subdirectory

Some times in Drupal you may need to create a script in a subdirectory that runs with access to the Drupal functions.
After a few tries and find the inspiration in this site:
http://data.agaric.com/node/2825

This is the answers:

$base_dir = $_SERVER['DOCUMENT_ROOT'];
chdir($base_dir);
require_once "./includes/bootstrap.inc";
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

Powered by Drupal, an open source content management system

Creative Commons License
Permissions beyond the scope of this license may be available at http://phpia.net/contact