When http request comes to my server, how do I detect if it is from iphone, android, or other devices?
You can grab the User Agent. That tells what browser type it is (iphone, chrome, ie, anything)
To help you:
http://whatsmyuseragent.com/
http://en.wikipedia.org/wiki/User_agent