First Heroku App: Small API in PHP to Talk to .Net Core

I’ve recently been curious about switching to a time API for my time stamps and removing any dependency the app might have on the server for a timestamp.  Upon Googling I found some paid services, some free and of the free ones, I noticed one was hosted on Heroku.  I’ve heard of Heroku, but never had a reason to attempt to use it.  This was the perfect chance.

How I Created a Small “GetTime” API

First, I created a free account on Heroku, nothing special.  After verifying my email, I logged in to my Heroku Dashboard and up on the right hand corner, selected Create New App.  I named it my company-api and out popped an app.

I decided on just plain, legacy PHP and a simple DateTime string passed thru JSON encode, just to get started.  No authentication, no timezone,  just a simple spit out if a request to the site came, like this:


    $DateTime = new DateTime();
    $currentTime = $DateTime->format("Y-m-d H:i:s");
    echo json_encode($currentTime);

I created a Git repo for this brand new file and pushed it out.  Then, I went back to Heroku, Dashboard, My App and Deploy.  I selected Github as my deploy “resource” …

Connecting to and Calling An AS400 Program with i5_toolkit

I’m starting to document some of the ways I’ve begun to use Aura’s EasyCom i5 Connect package to connect PHP to our as400. This has been a long process of trying to webify some of our programs and get the information out.  (btw, we’re a small business and yearly the package is about $600 – very, very reasonable.)

Currently, we have a webserver (Windows Server) that hosts our website. On it, we installed the required Aura software (a Windows exe GUI and a PHP extension) to connect to our as400. The PHP pages then utilize that PHP extension to make calls to our as400. On our as400 side, our programmer created small programs to access the larger programs we need. So, I pass say 3 parameters via PHP, make a call via Ericom i5, and then the RPG does the brainwork. It passes back my requested parameters and sets up a datafile I can query using basic ODBC and mySQL. We may change this in the future, but we like the logic work taking place in RPG on the as400 (where all our data resides anyway) and PHP being the fetcher of such data.

So, first up,  here’s how I …