How can I get the group ID of a node? I have this node that belongs to a group, and I want to get the group ID of that node, to print it, something like $node-&gt;nid; but with the group id.

Is that possible?
The relationship between group content and a group is via a membership relation.  Since it is possible for group content to be a member of multiple groups then the following code will retrieve the list of groups:

$groups = og_get_entity_groups('node', $node);


This is a multidimensional array with the group entity_types as the key and memberships as the value. Each membership is an array with the membership id as they key and then group's entity id as the value.  So to go from a group content node, to all it's group parents you would use ... 

foreach (og_get_entity_groups('node', $node) as $entity_type =&gt; $og_memberships) {
  foreach ($og_memberships as $membership_id =&gt; $entity_id) {
    if ($entity_type == 'node') {
      // Assuming we only want to deal with node groups, we can
      // access the group node with...
      $group_node = node_load($entity_id);          
    }
  }
}