HTTP_STATUS (n) (only available on Wx PLC firmware >= F94.4)
Purpose Return the status of the last HTTP_COMMAND
Details There are 3 valid HTTP_STATUS parameter values; ie. 1 (HTTP Response status codes from server) and 2 (returned data availability status). 3 (HTTP_COMMAND process status)

The value returned by HTTP_STATUS(1), HTTP_STATUS(2) and HTTP_STATUS(3) is an integer that could negative, zero, or positive. Each return value corresponds to the state and circumstances of the HTTP_COMMAND.

The possible return values for these HTTP_STATUS function parameter values are specified below.

Function Returned value
HTTP_STATUS (1) This contains the response code received from the HTTP web server that the HTTP_COMMAND connected to. E.g. 200 when successfully retrieve the file. 404 when file is not found. etc.

  0    = Initial state or after a network reset.
 200 = Request Completed. Successfully processed request and received response from web server. Additionally, the request has been completed successfully. Read the response data using INPUT_STR(1) function.
 202 = Request Accepted. Successfully processed request and received response from web server. However, it is not known if the request completed successfully. Read the response data using INPUT_STR(1) function.
 404 = file requested by HTTP_COMMAND is not found.

HTTP_STATUS (2) Check if there are still response data from webserver that can be read by HTTP_INPUT$(1) command.

  0 = No data. INPUT_STR$(1) will return an empty string.
  1 = Response data from web server is available. Read it using the HTTP_INPUT$(1) command.

Example :
FOR I = 1 to 100
   IF INPUT_STATUS(2) = 0   ' No more response data to read
      EXIT
   ENDIF
   A$ = HTTP_INPUT$(1)
   PRINT #7 A$
NEXT
					
HTTP_STATUS (3) Check if the last HTTP_COMMAND task has been successfully scheduled.

   0 = Last HTTP_COMMAND task is scheduled and is in progress
   1 = Last HTTP_COMMAND task successfully completed.
  -1 = Last HTTP_COMMAND task failed. Check system & user log for the cause of the error.


See Also HTTP_CONFIG, HTTP_COMMAND, HTTP_POST_BUF, HTTP_INPUT$(1)

backbutton.gif (507 bytes)  Basic to TBASIC Reference Manual