It's not clear what context you want to fetch data from but if you want a separate PHP script then look at the External Code section of the docs.
Then look at the Functions page to see what you can do with Q2A, whether in external code or in a plugin. You'll probably want the qa_db_query_sub function to run custom SQL queries, but there are also many other functions if you want specific data like a user account.