I have a LAMP (PHP) web app which need to interface with programs on an IBM 3270 mainframe (via Microsoft SNA Server). One solution I'm looking at is screen-scraping via 3270. (I'm integrating the present with the past!)
Many years ago, I wrote C code which used HLLAPI as the basis for such a task.
I haven't used it but maybe look at http://x3270.bgp.nu/ which says has a version:
s3270 is a displayless version for writing screen-scraping scripts