Dynamic status update without database interaction

I am working on a system which displays the live status/stages of the system creation.

Example -: If I fill a hosting form then on my form it should display the status of the system. Like domain created, files hosted , etc in a progress bar. I want to achieve this without using data base.

Read More

Note: All the operations will be performed on a different system and my hosting form is on a different system.

Hurdles: Multiple forms can be filled at the same time.

What I have tried.

  1. Writing steps to database and read from there.
  2. Do curl post to a specific function. But in that case I have to use DB.

I am looking for a way where there is no db interaction required and I can see the status dynamically after filling the form.

Related posts

Leave a Reply

2 comments

  1. There is 1 solutions for this:

    1. Send and receive information using AJAX from and to server wich has installed software with API

    I think this is what you want to do.

  2. Feel free to correct my understanding of the issue, but here’s how I see this at the moment.

    1. You have a web site that has multi stage forms. So user fills the first one, then sends it, and gets the next one to be filled.
    2. You also have a web server, probably running PHP, that handles user interaction. So whenever user fills a form, your server application proceeds with that and gives the user the next one.
    3. Furthermore, there are multiple external servers and services that your PHP application gives orders to based on the information given by the user.
    4. You will want to show process information from external services whenever things do proceed.
    5. Finally, you don’t want to use a oh so heavy database solution if a lighter one exists.

    If I have gotten the facts about right so far, there may be a suitable solution to help you out.

    To begin with, it’s worth mentioning that PHP has its own session mechanism. Its data storage defaults to flat files, which may or may not be suitable for your use. Yet it requires almost no configuration or setup and offers a persistent storage, so it’s by far the easiest option, in my opinion.

    Note, that if the amount of information to be stored is very small, you can bypass the application data storage altogether and stick to the cookies. Read on form submit, update during the PHP process and send update the cookie accordingly as part of the response. You can encrypt the data in order to make it harder to alter by the user.

    Lastly, there’s this option called cache. There are multiple technologies for this when working on PHP. For instance: xcache and APC. These store information in RAM, which obviously has its downsize, since data can basically vanish at any given time – you can control this, though.

    No matter the choice of data storage, the general idea is as follows:

    • When user first interacts with your service, create a session identifier and an approriate cookie to identify the user later on.
    • When user has filled the first form and sends it, read the information and either store it in the cache or in the cookie. When storing and reading information from and to the cache, either prefix or namespace it using the session identifier used by user. This way there can be multiple users using the service at any given time! When done, send the second form to be filled.
    • When user eventually sends the second form, read from the cache or from the cookie the information given to the first one. Now, should the information be missing, there has been an error in the filling process (or cache has been invalidated due to long time period or cookie expiration time – you will want to take these things into account, too).
    • So long things are going nicely, build up your information gathered from the forms. Whenever you have enough information to do so, make a request to the external service to really make things happen.
    • Now, lastly. You can do periodical ajax requests from the client. Therefore you get not only the forms sent, but also occasional “how is the process going?” queries. Now, whenever you receive a request like that from the browser, you can identify the user by session identifier and make a call from your PHP application to your external service, asking for a status of any kind. You then simply forward the information to the browser that has been waiting the answer all this time.

    Note that you may have to store service spesific information in your cache to do this.

    This setup, however, effectively gives you the ability to control data flow in your PHP application without revealing the services behind it. It’s also lightweight enough to develop as it requires no additional external software for short term data storage.