Difference between revisions of "POSTURL()"

From Lianjapedia
Jump to: navigation, search
(Created page with "==Purpose== Function to send an HTTP POST request to the specified URI ==Syntax== POSTURL(<expC1> [, <expN> [, <expO> | <array> [, expC2>]]]) ==See Also== AT(), [[A...")
 
Line 19: Line 19:
 
|-
 
|-
 
|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
|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 08:33, 9 January 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