Unfortunately, you cannot do that easily in any recent Moodle (1.7 or newer). You will want to use the PHP function "get_my_courses()" that is in lib/datalib.php -- you will see that it uses a lot of the functionality in lib/accesslib.php
Perhaps you can use XMLRPC to get it straight from PHP? Remember that it is _very_ expensive to compute, so cache it aggressively.