Extending Drupal Functionality to Custom PHP Page
The only file you need to include is '/includes/bootstrap.inc', but you also need to define the DRUPAL_ROOT constant and run drupal_bootstrap() to have access to the API/database/etc.:

define('DRUPAL_ROOT', getcwd());

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

// Your code here


It's exactly the same code that you'll find in the standard index.php file, minus a call to menu_execute_active_handler() which isn't necessary if you dont want to build and output a normal Drupal page.