These terms come from Roman Jakobson's model of the functions of language. (Jakobson is the legendary structuralist linguist of whom it was said that he spoke 36 languages, each with a foreign accent.) The model had six functions; the others were emotive, conative (issuing a command), metalingual, and poetic.
The bit about using phatic language mostly with people one doesn't know well is not from Jakobson. I made it up, and it's probably wrong. I didn't go over that sentence 20-50 times :).