try {
    envinit();
    $aabService = new AABService(getFqdn(), getSessionToken());
    $contact = $aabService->getMyInfo();
    $tables = array();
    $tables[] = generateContactTable($contact);
    $contactId = $contact->getContactId();
    $table = generatePhonesTable($contactId, $contact->getPhones());
    if ($table !== null) {
        $tables[] = $table;
    }
    $table = generateEmailsTable($contactId, $contact->getEmails());
    if ($table !== null) {
        $tables[] = $table;
    }
    $table = generateImsTable($contactId, $contact->getIms());
    if ($table !== null) {
        $tables[] = $table;
    }
    $table = generateAddressesTable($contactId, $contact->getAddresses());
    if ($table !== null) {
        $tables[] = $table;
    }
    $table = generateWeburlsTable($contactId, $contact->getWeburls());
    if ($table !== null) {
        $tables[] = $table;
    }
    $arr = array('success' => true, 'tables' => $tables);
} catch (Exception $e) {
    $arr = array('success' => false, 'text' => $e->getMessage());
}
        }
        $table = generateAddressesTable($contactId, $contact->getAddresses());
        if ($table !== null) {
            $tables[] = $table;
        }
        $table = generateWeburlsTable($contactId, $contact->getWeburls());
        if ($table !== null) {
            $tables[] = $table;
        }
    }
    foreach ($qcontacts as $qcontact) {
        $tables[] = generateQuickContactTable($qcontact);
        if ($qcontact->getPhone() !== null) {
            $tables[] = generatePhonesTable($qcontact->getContactId(), array($qcontact->getPhone()));
        }
        if ($qcontact->getEmail() !== null) {
            $tables[] = generateEmailsTable($qcontact->getContactId(), array($qcontact->getEmail()));
        }
        if ($qcontact->getIm() !== null) {
            $tables[] = generateImsTable($qcontact->getContactId(), array($qcontact->getIm()));
        }
        if ($qcontact->getAddress() !== null) {
            $tables[] = generateAddressesTable($qcontact->getContactId(), array($qcontact->getAddress()));
        }
    }
    $arr = array('success' => true, 'tables' => $tables);
} catch (Exception $e) {
    $arr = array('success' => false, 'text' => $e->getMessage());
}
echo json_encode($arr);
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */