I searched Google search APIs and didn't find a way to get a website position rank based on a searched keyword and i thought its impossible.
But i found by luck this website "http://www.tools4google.com/search-google-position/keyword_tracking.php" which is doing the same as i want to do, so i just want to know the idea behind that, or its something illegal.