Home » Php » php – How to 3270 screen-scrape from a Linux-based web app

php – How to 3270 screen-scrape from a Linux-based web app

Posted by: admin July 12, 2020 Leave a comment


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.

  1. Is HLLAPI still the best way to approach this task?
  2. If so, would I be best off just writing a C app to undertake the work necessary and exec() this C app from php?
  3. Are there any open source HLLAPI providers for Linux? (In the past I used commercial solutions such as Cleo.)
How to&Answers:

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


I’m currently trying to do a similar thing but with a command line Python script.
I open a pipe to the s3270 (on Windows the exe name is ws3270) to connect to the server and send all commands.

Read carefully those part of the documentation for scripting:




While I have no experience with 3270, I would expect that finding and calling on an outside application or library is your best bet. PHP is not an all-purpose tool, hacking into a non-web communications protocols is best left to languages like C or Java that can handle that well.


Screen scraping 3270 applications is a perfectly valid way of getting at data. Many of these applications haven’t changed for years, or decades in some cases. Sometimes there is simply no API or other programmatic way of getting at the necessary data.


Nighthawk: You could always learn CORBA, that monstrosity of a system was designed to let C programs talk to remote COBOL systems or random stuff written in PL/I or something.

But seriously, if the old app has no API, 3270 screen scraping is fine. There’s a lot of similarities between 3270 screens and HTML forms (unlike character mode terminals).