FormerMember

WEB BOI

Posted By FormerMember

The ScriptBasic distribution comes with a web server version of the language. It runs as a Windows process and is multi-threaded. The best part is you can run your BOI external scripts on the web server with no modification to your BOI specific code. The ScriptBasic application web server can run standalone or as a proxy to Apache.

Windows Service

I'm putting a couple examples together that reads the AR_Customer table with BOI and ODBC and displays the results in a web browser. My plan is to create a separate Windows install for the ScriptBasic web server.

If you're running Sage 100c, you can run your ScriptBasic web application in the 100 launcher's web browser.

This will be offered as open source and FREE.

  • FormerMember
    0 FormerMember in reply to FormerMember

    I got the echo program running on my sandbox repository server if you want to see the ScriptBasic web server (standalone) working. (Raspberry Pi 4B 8GB + fiber connetion)

    In your web browser address line type in the following.

    23.90.90.91:9090/home/echo

    23.90.90.91:9090/home/webclock

    The ScriptBasic code for this echo program is in a early post of this thread.

  • FormerMember
    0 FormerMember in reply to FormerMember

    This example is using the cURL extension module and the Open Weather API to return the current weather forecast in Anacortes, WA USA.

    ' OpenWeather - Curl Example
    
    IMPORT cgi.bas
    IMPORT curl.bas
    
    FUNCTION MATCH(segment)
      MATCH = JOKER(segment)
    END FUNCTION
    
    place = "Anacortes,US"
    
    ch = curl::init()
    curl::option(ch, "URL", "http://api.openweathermap.org/data/2.5/weather?q=" & place & "&units=imperial&appid=MY_APP_KEY")
    curl::option(ch, "CUSTOMREQUEST", "GET")
    response = curl::perform(ch)
    curl::finish(ch)
    
    cgi::Header 200,"text/html"
    cgi::FinishHeader
    
    PRINT """
    <html>
    <body>
    """
    
    PRINT "<h2>JSON Response</h2>\n"
    PRINT response, "<br><br>", "\n"
    PRINT "<h2>LIKE Parsed</h2>\n"
    
    IF response LIKE "*lon\":*,\"lat\":*}*temp\":*,*pressure\":*,*humidity\":*}*dt\":*,*country\":\"*\"*timezone\":*,*name\":\"*\"*" THEN
       PRINT "Country:    ", MATCH(13), "<br>\n"
       PRINT "City:       ", MATCH(17), "<br>\n"
       PRINT "Longitude:  ", MATCH(2), "<br>\n"
       PRINT "Latitude:   ", MATCH(3), "<br>\n"
       PRINT "Date/Time:  ", FORMATDATE("MM/DD/YEAR 0H:0m:0s", MATCH(11) + MATCH(15)), "<br>\n"
       PRINT "Tempreture: ", MATCH(5), " F<br>\n"
       PRINT "Pressure:   ", MATCH(7), " hPa<br>\n"
       PRINT "Humidity:   ", MATCH(9), " %<br>\n"
    END IF
    
    PRINT """
    </body>
    </html>
    """
    

    23.90.90.91:9090/home/web4cast