When I create a new script in a separate php file to run for Drupal, I need to add the following lines on top in order to access all Drupal APIs:
require_once \'./in
yes, it's one way to enter drupal api. Sometime chdir("dir to drupal dir"); required, if you call php script from other directory.
chdir("dir to drupal dir");