Difference between revisions of "POSTURL()"
From Lianjapedia
Yvonne.milne (Talk | contribs) |
Yvonne.milne (Talk | contribs) |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 3: | Line 3: | ||
==Syntax== | ==Syntax== | ||
− | POSTURL(<expC1> [, <expN> [, <expO> | <array> [, expC2>]]]) | + | POSTURL(<expC1> [, <expN> [, <expO> | <array> [, <expC2> [, <expC3>]]]]) |
==See Also== | ==See Also== | ||
Line 11: | Line 11: | ||
The POSTURL() function sends an HTTP POST request to the specified URI. | The POSTURL() function sends an HTTP POST request to the specified URI. | ||
− | {| class="wikitable" width = 100% | + | {| class="wikitable" width="100%" |
!Parameter||Description||Example | !Parameter||Description||Example | ||
|- | |- | ||
|<expC1>||Fully qualified URI||"http://www.myserver.com/mywebservice.aspx" | |<expC1>||Fully qualified URI||"http://www.myserver.com/mywebservice.aspx" | ||
|- | |- | ||
− | |valign=top|<expN>||The timeout in seconds for the request (default 30). Set this to 0 for no timeout.||valign=top|30 | + | |valign="top"|<expN>||The timeout in seconds for the request (default 30). Set this to 0 for no timeout.||valign="top"|30 |
|- | |- | ||
− | |valign=top|<expO> |<br/><array>||valign=top|By default the data is sent as "text/plain" in the HTTP body but you can add custom headers to the object/dynamic array and POST SOAP requests and read the response from the remote server returned as a string of text | + | |valign="top"|<expO> |<br/><array>||valign="top"|By default the data is sent as "text/plain" in the HTTP body but you can add custom headers to the object/dynamic array and POST SOAP requests and read the response from the remote server returned as a string of text |
− | |valign=top|array("type" => "Content-Type: text/xml") | + | |valign="top"|array("type" => "Content-Type: text/xml") |
|- | |- | ||
|<expC2>||Filename or character expression that will be sent as the POST body||"myfilename.xml" | |<expC2>||Filename or character expression that will be sent as the POST body||"myfilename.xml" | ||
+ | |- | ||
+ | |<expC3>||Filename into which response will be written||"response.xml" | ||
|- | |- | ||
|} | |} | ||
Line 28: | Line 30: | ||
<code lang="recital"> | <code lang="recital"> | ||
// send a soap request | // send a soap request | ||
− | + | responsefile = posturl("http://www.myserver.com/somewebservice.aspx", ; | |
30, ; | 30, ; | ||
− | array("type" => "Content-Type: | + | array("type" => "Content-Type: application/soap+xml", "host" => "Host: localhost"), ; |
− | " | + | "requestdata.xml","response.xml") |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
// submit a form | // submit a form |
Latest revision as of 13:07, 6 March 2014
Contents
Purpose
Function to send an HTTP POST request to the specified URI
Syntax
POSTURL(<expC1> [, <expN> [, <expO> | <array> [, <expC2> [, <expC3>]]]])
See Also
AT(), ATNEXT(), FCLOSE(), FCREATE(), FERROR(), FGETS(), FILETOSTR(), FOPEN(), FPUTS(), FREAD(), FREADSTR(), FWRITE(), GETURL(), ISSERVER(), JSON_DECODE_FILE(), SUBSTR(), STUFF(), STR(), STREXTRACT(), STRTOFILE(), STRTRAN(), STRZERO(), TRIM(), XML_DECODE_FILE()
Description
The POSTURL() function sends an HTTP POST request to the specified URI.
Parameter | Description | Example |
---|---|---|
<expC1> | Fully qualified URI | "http://www.myserver.com/mywebservice.aspx" |
<expN> | The timeout in seconds for the request (default 30). Set this to 0 for no timeout. | 30 |
<expO> | <array> |
By default the data is sent as "text/plain" in the HTTP body but you can add custom headers to the object/dynamic array and POST SOAP requests and read the response from the remote server returned as a string of text | array("type" => "Content-Type: text/xml") |
<expC2> | Filename or character expression that will be sent as the POST body | "myfilename.xml" |
<expC3> | Filename into which response will be written | "response.xml" |
Example
// send a soap request responsefile = posturl("http://www.myserver.com/somewebservice.aspx", ; 30, ; array("type" => "Content-Type: application/soap+xml", "host" => "Host: localhost"), ; "requestdata.xml","response.xml") // submit a form response = posturl("http://www.myserver.com/someformsubmission.rsp", ; 30, ; array("type" => "Content-Type: application/x-www-form-urlencoded"), ; "name=barry&product=lianja") if len(response) = 0 // no data was returned endif