In addition to the Dropbox app,
Documents for iPad does what you want.
Marvin also does what you want - you can open a book in Dropbox or via OPDS. If it's an ePub, Marvin will display it, otherwise it will offer up the available 'Open in' apps.
If you want to write such a program yourself, you're probably better off in an iOS developer's forum.
G