Difference between revisions of "POSTURL()"

From Lianjapedia
Jump to: navigation, search
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> &#124;<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> &#124;<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"

Revision as of 11:21, 5 February 2013

Purpose

Function to send an HTTP POST request to the specified URI

Syntax

POSTURL(<expC1> [, <expN> [, <expO> | <array> [, expC2>]]])

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"

Example

// send a soap request
response = posturl("http://www.myserver.com/somewebservice.aspx", ;
                           30, ;
                           array("type" => "Content-Type: text/xml"), ;
                           "somefilename.xml")
 
if len(response) = 0    
    // no data was returned
endif 
 
// 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