[support] Authentication from an external script when using API's??

Earnie Boyd earnie at users.sourceforge.net
Sat Jun 16 15:40:48 UTC 2012


On Sat, Jun 16, 2012 at 11:21 AM, Wipe_Out wrote:
> Hi,
>
> I am attempting to access the Drupal data from an external php script..
>
> I am able to connect to drupal with the following..
>
> //Bootstrap Drupal
> $drupal_path = '/var/www';
> chdir($drupal_path); //Path to drupal
> $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
> define('DRUPAL_ROOT', $drupal_path);
> require_once './includes/bootstrap.inc';
> drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
>
> So that's fine..
>
> Now I am trying to access content that doesn't have anonymous view access so
> I need to authenticate the external script somehow..
>
> Can anyone point me in the right direction as to what API's I need to use
> to authenticate to drupal in order to access the content?

$user = user_load(1);

Or what ever user you think would be best.

http://api.drupal.org/api/drupal/modules%21user%21user.module/function/user_load/7

-- 
Earnie
-- https://sites.google.com/site/earnieboyd


More information about the support mailing list