Download Target CoDeSys Reference Manual

Transcript
Target CoDeSys Reference Manual
1.12.2 HTTP_Post
FUNCTION HTTP_Post : INT
VAR_INPUT
Request : STRING;
Query : STRING;
Result : STRING;
Result_Max_Len : INT;
DNS : STRING;
END_VAR
Sends HTTP POST request and receive the result page.
Return Value
0 : success
-1...-4: DNS client error
201...265: TCP/IP functions error
1/2/4/8/16: SSL functions error
Input Parameters
Request
URL of the requested resource (max 400 characters)
Query
String with the parameters list (max 2000 characters)
Result
String to receive the response (max 4000 characters)
Result_Max_Len
Max number of characters to receive
DNS
Specific DNS server address (xxx.xxx.xxx.xxx)
Comments
This function sends a request to a web server using an URL with POST method and returns all the string (including header) of the
page. The Request parameter is the string containing the request with the form:
Username:Password@Host:Port/Path
Username:Password@
Host
:Port
/Path
send optional authorization fields
address of the server that has the resource
select a port other than the default (80)
full path to the server resource
Query parameter is the string containing the parameters:
Query
parameters to send: par1=xxx&par2=yyy&par3=zzz...
The Result parameter is the string in which to insert the response from the server. This response contains a header, typical of HTTP,
followed by the actual output of the server (body). The header and the body are separated by a blank line, which can be searched as
the beginning of the body part. The Result_Max_Len parameter is the maximum number of characters to receive in the response
string.
The DNS parameter allows the specification of a different DNS server which has priority over the default setting into CHIP.INI
109