The unique key is email address. Perhaps there is a CiviCRM API?
EDIT
There is a CiviCRM API. My code so far:
civicrm_initialize();
$content = civicrm_api('contact', 'getvalue', array(
'email' => $GLOBALS['user']->mail,
'version' => 3,
'return' => 'first_name')
);
I need the user's group, not first name.