You have to include the file that has the Wordpress functions located on the main directory of the Wordpress Installation:
define('WP_USE_THEMES', false);
require_once('../../../wp-load.php');
../../../ = path to the main directory on your installation
I found a nice tutorial about this here.