Access Drupal from an external PHP script

You can access Drupal core from the external PHP script using below code:-

// Include drupal root
define(‘DRUPAL_ROOT’, ‘/path/to/drupal’);
require_once DRUPAL_ROOT . ‘/includes/bootstrap.inc’;

// Load Drupal
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

// Your code goes here. You can access all the Drupal functions like db_query(), node_load(), user_load() etc.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s