What you are describing is a webservice, so yes, of course it's possible...
Thez simplest way is to use an awp page (you can call it directly) and pass it the parameters you need.
A StringDisplay at the end of your code will send your data back as a string (you can format it any way you like, xml, json, csv, etc.)