restReqPostGet (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

ALL

Firmware version:

2.10.00


This function will read a post parameter from a request.

If a value is specified multiple times, all the values will be provided, separated by commas.

 

Input:

req : SYSHANDLE

A handle to the request.

 

name : STRING

The name of the post parameter to read.

 

check_case : BOOL (Default FALSE)

If set to TRUE, the name will use case sensitive comparison.

If left at FALSE, the name will use case insensitive comparison.

Note that if the same name is present with different case, only the value for the first matching name will be returned.

 

 

Output:

value : STRING

The value of the parameter.

 

 

Returns: INT

1


- Success

0


- Not supported

-1


- Invalid request

-2


- The query was not found

-7


- The value was too large for a string.

 

Declaration:

FUNCTION restReqPostGet : INT;
VAR_INPUT
  req            : SYSHANDLE;
  name           : STRING;
  check_case     : BOOL := FALSE;
  value          : ACCESS STRING;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM example;
VAR
  rc        : INT;
  str, name : STRING;
  i         : INT;
  req       : SYSHANDLE;
END_VAR
BEGIN
  ...
 
  i:=0;
  // Get name of post parameter
  rc := restReqPostKey(req:=req, idx:=i, name:=name);
  WHILE rc > 0 DO
    // Get value of post parameter
    restReqPostGet(req:=req, name:=name, value:=str);
    DebugMsg(message:=" "+name+"="+str);
    i:=i+1;
    // Get name of next post parameter
    rc := restReqPostKey(req:=req, idx:=i, name:=name);
  END_WHILE;
  ...
END;
END_PROGRAM;