How to get tags and categories?

get_the_terms( $id, $taxonomy ); is what you’re looking for, I guess.

You can pass array as $taxonomy param. So this snippet:

$posttags = get_the_terms($post->ID, array('category', 'post_tag'));

should do exactly what you’re trying to achieve.