How could I change gravity depending on phones rotation?

How could I get the phones exact rotation and change the gravity mirrored to the phones rotation? (I don’t have a script for it yet because I cannot find help getting the phones exact rotation)

Scroll to the bottom of this page. rotation=attitude.

Now how could I modify the gravity?