How to automatically obtain the "kingdom" of a species from its name?
You could try the Catalogue of Life


  The Catalogue of Life is the most comprehensive and authoritative global index of species currently available. It consists of a single integrated species checklist and taxonomic hierarchy. The Catalogue holds essential information on the names, relationships and distributions of over 1.6 million species. This figure continues to rise as information is compiled from diverse sources around the world.




You can export the search results (in the above example indicating Kingdom Plantae for search term "Prunus persica") and analyze the exported table in your program of choice.