Browser Client URL


 

The Broswer URL logon string logs the client onto the PL/B Web Server and initiates the execution of a PL/B program. The Browser URL logon string is composed of five (5) components formatted as follows:

 

(1) {Ip|Url}:{portnum}/{prgname}[?[runopt={runopts}][cmdline={prgopt}]

 

(2) {Ip|Url}:{portnum}/{htmlpage}

 

Where:

{Ip|Url}
The IP\URL address is the same as used for any web server. The IP address needs to provide a link to the final IP address that is specified by the PLBWEB_ADDRESS keyword found in the PLBWEBSRV.INI configuration file.
{portnum}
The {URL} component is required and specifies the port number used by the PL/B Web Server. This port number can either be specified in the PLBWEB_ADDRESS keyword or the default port number of 8081 can be used.
{prgname}
The {prgname} component is optional. This component identifies the PL/B program name with extension that is executed by the PL/B Web Server. If the {prgname} is not specified, the PL/B Web Server uses ‘answer.plc’ when the PLBWEB_DEFAULT keyword is not defined or nulled and the PL/B Answer\Master concept is applied. However, if the PLBWEB_DEFAULT keyword is defined, the program identified is used as the default program when the {prgname} is not used.
{runopts}
The {runopts} component is optional and must follow the ‘?’ character in the URL logon string. The {runopts} string gives the runtime options used when executing the PL/B Web Server child task. These runtime options are the same as expected for the Application Server runtime. The {runopts} must be preceded by the ‘runopt=‘ keyword.
{prgopts}
The {prgopts} component is optional and must follow the ‘?’ character in the URL logon string. The {progopts} string gives the PL/B user program command line parameters that arepassed to the PL/B program in the S$CMDLIN global variable. The {prgopts} string must be preceded by the ‘cmdline=‘ keyword.
{htmlpage}
The {htmlpage} shown in format (2) allows a HTML web page to be loaded and executed which causes a PLB program to be executed by the PWS server. The execution of the HTML\JavaScript in the {htmlpage} depends on the behaviors and restrictions implemented by the type and version of client browser being used. A HTML web page can be implemented to use HTTP GET or POST requests to invoke execution of the PLB program at the PWS server.

Examples of Browser URL logon strings using format (1):

 

http://127.0.0.1:8081

 

A simple URL logon string that causes the PL/B Web Server to execute a PLC program based on the PLBWEB_DEFAULT keyword setting. If the PLBWEB_DEFAULT keyword is not defined or it is assigned to be null, the PL/B ‘answer.plc’ program is executed at the PL/B Web Server with the PL/B Answer\Master concept applied. Otherwise, the PL/B Web Server executes the PLC program assigned to the PLBWEB_DEFAULT keyword with the PL/B Master concept applied.

 

http://192.168.1.105:8081/master.plc

 

This URL logon string causes a logon to a workstation on a network where the PL/B Web Server has been installed. In this case, a ‘master.plc’ program is executed.

 

http://www.sunbelt-plb.com:8081/answer.plc?runopt=-mv3000000

 

This URL logon string causes a logon to a PL/B Web Server executing on the Sunbelt Server. In this case, a ‘answer.plc’ program is executed. The ‘-mvNNNNNN’ runtime option changes the PL/B program memory space used to execute the program.

 

http://127.0.0.1:8081/answer.plc?cmdline=parm1=5,%20Next&runopt=-dr

 

This URL logon string causes the PL/B ‘answer.plc’ program to be executed at a PL/B Web Server which is installed on the same workstation where the browser is executing. When the ‘answer.plc’ program starts executing, the S$CMDLIN global variable is loaded with the ‘cmdline’ options string of “parm1=5, Next”. Please notice that the ‘%20’ represents a white space or blank as stored into S$CMDLIN. In addition, the runtime option as specified for ‘runopt=‘ is set to ‘-dr’. The ‘-dr’ option is being used to start a GUI debug session using the GUI ‘DBGIFACE.PLC’ debugger which was previously loaded and available for debugging a PL/B program. When using the '-dr' option to invoke a GUI debug session, see the PL/B Runtime Reference keyword named 'PLBDBG_LOGON' for keyword setup details.

Examples of Browser URL logon strings using format (2):

 

http://www.sunbelt-plb.com:8081/mypage.html

 

This URL logon string causes a logon to a PL/B Web Server executing on the Sunbelt Server. In this case, a HTML web page file named 'mypage.html' is downloaded to a client browser and executed. The following HTML\Javascript web page shows very simple coding to invoke a PWS PLB program after downloading the 'mypage.html' from a 3rd party Web Server.

 

Using HTML web page with HTTP GET request:

 

In this case, the following HTML page uses a HTTP GET request to logon to a PWS server when the submit operation occurs and the JavaScript document 'submit' instruction executes. Also, the 'runopt' and 'cmdline' data is added to the URL command by the client browser when the URL command is sent to the PWS server which executes the program 'userprog.plc'. In this case, the 'runopt' and 'cmdline' data appears in the browser URL command.

 

<html>

  <head></head>

  <body>

    <form id="myForm" action=" http://www.userpws.com:8081/userprog.plc" method="GET" >

      <input type="text" name="runopt" value="-g100000" style="display: none">

      <input type="text" name="cmdline" value="Edward;MyPassword;More upto 250 bytes!!" style="display: none">

    </form>

    <script>

      document.getElementById("myForm").submit();

    </script>

  </body>

</html>

 

Using HTML web page with HTTP POST request:

 

In this case, the following HTML page uses a HTTP POST request to logon to a PWS server where the submit operation is performed using a JavaScript instruction. Also, the 'runopt' and 'cmdline' data is submitted in the HTTP POST request without being shown to the end-user in the browser URL command.

 

<html>

  <head></head>

  <body>

    <form id="myForm" action=" http://www.userpws.com:8081/userprog.plc" method="POST" >

      <input type="text" name="runopt" value="-g100000" style="display: none">

      <input type="text" name="cmdline" value="Edward;MyPassword;More upto 250 bytes!!" style="display: none">

    </form>

    <script>

      document.getElementById("myForm").submit();

    </script>

  </body>

</html>

 

 

See Also: PL/B Web Server Command Line



PL/B Web Server The PL/B Web Client Apps