getPost common function