URL Request to GET a File |
|
URL Request: |
protocol://server[:socket]/filename.ext[?argument[&argument...]] |
Where:
protocol |
Applicable network protocol; e.g. http:// or ftp://. |
server |
Server name. Use an IP (Internet Protocol) address such as 127.0.0.1 or a DNS (domain name) such as www.pvxplus.com. |
socket |
Optional TCP socket or port number (an integer preceded by a colon). Valid range: 1 to 65535. By default, all requests from a client are sent to TCP socket 80, unless you override the port number in your URL statement. To do this in any HTTP-compliant browser, include a : colon and the port number right after the server name. Example: The first URL below would default to TCP socket 80, and the second would connect with TCP socket 3000: |
filename.ext |
Item that the browser is requesting. This could be the name of:
See URL Request to Run a PxPlus Program and Appendix - HTML Examples. |
argument(s) |
Optional argument(s). If you include arguments:
Note:
|
The Web Server uses the information in your URL statements to locate the file or information being requested. Each object on a page is a separate request from a browser to a web server. The PxPlus Web Server can handle virtually any type of file and serve it back to the client.
Exception: The Web Server does not currently allow for CGI scripts other than PxPlus programs.
The following table provides some request examples:
Example 1: |
This example is a request for the file "myfile.htm" from the root directory of the Web Server www.pvxplus.com. Since no optional TCP socket is specified, the request would be made to the www.pvxplus.com Web Server on TCP socket 80 (default): http://www.pvxplus.com/myfile.htm?numvar1&stringvar=abc%20def This would pass two variables to the file: numvar1 would become the numeric variable numvar1 with a value of 1. |
Example 2: |
This example, http://127.0.0.1/somprog?one+two+three, is a request for the file "someprog" from the Web Server currently running on the local machine and passes it three arguments, which the Web Server returns in %ARGS$[%ARGS] as: %ARGS$[1]="one", %ARGS$[2]="two" and %ARGS$[3]="three" The value in %ARGS=3. See PxPlus Web Server Variables. |
Example 3: |
The two examples below are requests for the program "someprog" from the sub-directory "somedir" in the Web Server's root directory. The first example creates a numeric variable, ONE=1. The second passes the values in %ARGS$[1]="one" and %ARGS=1: http://127.0.0.1/somedir/someprog?one |
Example 4: |
This example requests the file named "myprog", which, if it is a PxPlus program, will start execution at the label LOOP: http://127.0.0.1/myprog;loop?comp=001&name=Your+Name+Here&copies=3©&now+then It is passing the following from the URL for use in the PxPlus program: comp=001 as COMP$="001" |
Example 5: |
This example is a request to the Web Server listening on port 2000 to RUN the file "someprog", if it is a PxPlus program: http://127.0.0.1:2000/someprog?name=you&name=me&name=them Note that the arguments all have the same variable name. This is handled as a special case. When a variable name is passed more than once, the Web Server creates a single variable (in this instance, NAME$) and concatenates the data from each consecutive pass to the previous value in the variable as +SEP+extra data (in this instance, NAME$="you"+SEP+"me"+SEP+"them"). |
Example 6: |
The Web Server builds a special COMPOSITE STRING named CGI$. When you pass variables (either string or Boolean numeric, but not arguments), the Web Server builds an IOLIST of your variable names and then DIMensions CGI$ to that IOLIST. Variable names passed more than once only appear in the IOLIST once: http://127.0.0.1/myprog;loop?comp=001&name=Your+Name+Here&copies=3©&now+then For the example above, a PRINT LST(IOL(CGI$)) directive returns: IOLIST COMP$,NAME$,COPIES$,COPY You can assign the current data values to the DIMensioned composite string CGI$ from the variables passed in the URL by using CGI$=REC(IOL(CGI$)) when RUNning your program. This allows you to gain access to the data as composite string elements, in this instance, with the following values: CGI.COMP$="001" CGI.NAME$="Your Name Here" CGI.COPIES$="3" |