Description |
HTTPPost (Magic xpa 4.x)
This function is deprecated; but will continue to run if used in a program. Instead of this function, you should use the HTTPCall function, which is a more generic function.
Posts information using an HTTP request and returns an HTML or XML result of the HTTP request as a BLOB data object.
|
Syntax:
|
HTTPPost(URL, body, header line 1, header line 2)
|
Parameters:
|
URL: A string that represents an HTTP address and lets you activate and post information. When a Magic xpa client is accessing a web server that requires a user name and password, the URL should be HTTP://User:Password@[URL]
You can also support secret names using: HTTP://%user_secretname%:%pass_secretname%@[URL]
Body: A BLOB field containing textual information that is posted, such as var1=100&VAR2=200.
Header lines: A string providing additional request header information. You may specify as many header information strings as required.
|
Returns:
|
A BLOB data object with the information results from the posted HTTP message retrieved by the URL. If the function fails to make the connection, a blank value is returned.
|
Example:
|
HTTPPost('http://localhost/Service',A,'User-Agent:"Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)"')
where:
'http://localhost/Service' is the URL
A is a BLOB value that contains a collection of variables
'User-Agent:"Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)"' is a header string
|
Note:
|
-
The HTTPPost function can connect through a proxy server. You can define your proxy server in the Magic.ini file or in the HTTP Proxy – Address Port environment setting.
-
The retrieval phase of the function can be set to stop by defining the HTTP timeout in the Magic.ini file. When an HTML file or any textual data is retrieved, you can query the returned text stream by using the available string manipulation functions.
-
Use the HTTP Framework setting to define the underlying infrastructure.
-
Use the Blb2File function to store the retrieved file on your disk.
-
When the data contains special characters (e.g. %,&,<,>…), if you do not want the data translated, then include 'content-type: text/html' in the HTTP header of the request.
-
The URL address is automatically encoded.
-
If there is a @ character in the URL, such as 'HTTP://myser:mypassword@myserver', only the address after the @ character will be encoded.
-
If the URL contains @ and you need to encode it all (and not just the part after the @), you should add @ as the first character in the URL. For example: '@http://myserver@data'. In this case, the entire URL will be encoded and the first @ character will automatically be removed. Since version: 3.1
|
See also:
|
HTTPGet
Using HTTP Functions with an At Sign Character in the User Name or Password
The Online and Rich Client Samples projects (program EL22 and REL22)
|
|
|
---|