Search code examples
cobol

How to make http requests from COBOL


How to make http requests from COBOL?

For example, how can I create GET, POST requests to http://example.com?


Relevant information about what I have on my machine:

$ cobc --version
cobc (OpenCOBOL) 1.1.0
Copyright (C) 2001-2009 Keisuke Nishida / Roger While
Built    Nov 02 2013 00:16:01
Packaged Feb 06 2009 10:30:55 CET

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"

Solution

  • Steve Williams, as part of his work with tutorial level, but useful, COBOL sources, has posted some samples highlighting socket programming with GnuCOBOL.

    Too long to list here, but the RESTClient sample is well worth reading, and learning from.

    http://sourceforge.net/p/gnucobol/discussion/help/thread/762285b2/7ada/attachment/RESTclient.tar.gz

    That's not the only way to go about http request/response handling in COBOL, but it's working code and a handy leg up.

    See http://sourceforge.net/p/gnucobol/discussion/contrib/thread/2b474086 for the related conversation on SourceForge.