How can I call the Drupal function inside a PHP file?

I am trying to do some integration between Drupal and a webmail client, and I want to call the Drupal function from a PHP file that is part of the webmail client. In this case, the function I want to call is provided by the Contrib module, but I assume it does not matter.

So, if I have a page without Drupal called mail_login.php and you want to call the Drupal method foo_bar (), how can I do this?

+4
source share
1 answer

Depending on the complexity of what you want to name, you may need to download drupal:

require_once '/full/path/to/drupal/includes/bootstrap.inc'; drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); $return = menu_execute_active_handler(); if (is_int($return)) { switch ($return) { case MENU_NOT_FOUND: drupal_not_found(); break; case MENU_ACCESS_DENIED: drupal_access_denied(); break; case MENU_SITE_OFFLINE: drupal_site_offline(); break; } } 

After that, you can program the code as if you were in a Drupal environment, because, well, you!

+4
source

All Articles