示例#1
0
 public static function get_groups($api_key, $api_secret)
 {
     try {
         $api = new GoogleUtilityClient($api_key, $api_secret, 'HOSTED_OR_GOOGLE');
         $api->authenticate();
         $groups_response = $api->get('group/2.0/' . $api->domain);
         $entries = $groups_response['list']->getElementsByTagName('property');
         $groups = array();
         foreach ($entries as $entry) {
             if ($entry->getAttribute('name') == 'groupName') {
                 $groups[] = $entry->getAttribute('value');
             }
         }
     } catch (GoogleUtilityClientException $e) {
         throw new GoogleDomainException($e->getMessage());
     }
     return $groups;
 }