Why do cats bite when you pet them?

Imformation found here: http://www.vetstreet.com/our-pet-experts/why-does-my-cat-bite-me-when-i-pet-her

My cat when I pet him only sometimes bites me. My cat bites me when I play with him or he wants to have fun. I beileve that cats bite you when they want attention or fun. It like saying, "Okay, done with the petting PLAY WITH ME!"

Sometimes my cat bites me and then starts licking the spot where he bit me. I think this is a way they want to get attention but not in a mean way.