I'm looking for a simple way (such as a database) so that a program can get the kingdom of a species, knowing its name (such as "Prunus persica"). As a matter of fact the species I'm concerned with are the ones in the miRBase database.
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.