According to this "Cloaking refers to the practice of presenting different content or URLs to human users and search engines" The same link gives example as:
Serving a page of HTML text to search engines, while showing a page of images or Flash to users
Question: If I had correctly interpreted, there must be a mechanism for identification of the entity whether it is search engine or browser(user) at the web server.What do we call such mechanism? Or is it just a php or JavaScript code that redirects? How does a web-server actually know that entity'X' search engine and entity'Y' is web browser?