I’d like to know the best answer as well.
The channel entries api doesn’t have a method to get entries. The EE model “channel_entries_model.php” has one method to get all entry ids, and another to get an entry from an id, but there is no support for all the parameters that you have available with the channel entries tag within a template. The best way I found was to learn from Rob Sanchez’s json plugin:
http://devot-ee.com/add-ons/json/
What he does within his plugin is instantiate the Channel library and capture its output. You could do the same.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.