In Lianja Beta10 we have added an additional (optional) parameter to the GETURL( ) function to read a file from a remote web server and store its contents into a local file.
Code:
// perform a query against a remote server and return a chunk of JSON into a file
filename = geturl("http://www.myserver.com/getsomepage.rsp?name=smith&month=10", 30, array(), "myfilename.json")
if len(filename) = 0
// no data was returned
endif
We have also ddded a new function POSTURL( ) that operates in the same way as GETURL( ) but sends an HTTP POST request to the specified URI. By default the data is just sent as "text/plain" in the HTTP body but you can add custom headers to the "headers" associative array and POST SOAP requests and read the response from the remote server which is returned as a string of text. The last parameter can either be a filename or a character expression that will be sent as the POST body.
Code:
// 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
Bookmarks