HTTPPost (Magic xpa 2.x)

« Go Back


Created ByKnowledge Migration User
Approval Process StatusPublished

HTTPPost (Magic xpa 2.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.


HTTPPost(URL, body, header line 1, header line 2)


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.


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.


HTTPPost('http://localhost/Service',A,'User-Agent "Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)"')


'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


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 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.

See also:


The Online and Rich Client Samples projects (program EL22 and REL22)