WordPress- can I include wp-config to get db details

Solution:

You can use WPDB after including the necessary files, change the directory to fit your needs:

include_once $_SERVER['DOCUMENT_ROOT'] . '/wp-config.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/wp-includes/wp-db.php';

Oh and if you don’t know what it is: http://codex.wordpress.org/Class_Reference/wpdb