Contents - Index


PostUrl (function)

PostUrl(sUrl,sPostData,[sCaption],[nTimeout]) : string

Use this function to fetch a URL that requires POST data.

PostUrl is very similar to GetUrl() but the big difference is that this function allows you to submit POST data. 

sUrl - The Url to get
sPostData - The POST data to submit. Basically I have used the same syntax as SQLite to encapsulate the POST data. That is, each variable and data element should be enclosed in single quotes, and separated by a comma. If the data contains a single quote, it should be escaped by including two single quotes. See the example for more information.
sCaption -  Optional, default is "". Set to a non empty value to show a dialog with the percentage status of the download, and this caption in the title bar. Useful when the URL triggers a  large download. Set to "" or leave out this parameter when downloading small files or web pages and you don't need this status. 

Note1: Not all Urls return the size of the contents being downloaded so the percentage may not change.

Note2: The special caption "AddHeader:" can be used to add headers to the URL. For more information see this link

nTimeout - Optional, default is 40. The number of seconds to wait before the terminating (because of no response from the server)

Example:

The GSAK web site contains a sample page you can test. Firstly, you can test the sample script in a GUI way via this link http://gsak.net/testform.html.     



Submit and it sends it to the printpost.php page which will show this:



So the macro code to test this would be:
 

$url = "http://gsak.net/printpost.php"
$PostData = "'Variable1','data1','variable2','data2','variable3','data3'"
$result = PostUrl($url,$PostData)
msgOk msg=$result

 
Which should show:



Related: GetUrl()

Alpha List         Category List