Salesforce

HTTPGet (Magic xpa 2.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

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

Lets you retrieve the returned HTML result of an HTTP request as a BLOB object.

Syntax:

HTTPGet(URL, header line 1, header line 2)

Parameters:

URL: A string that represents an HTTP address that lets you retrieve an HTTP request. 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]

Header lines: A string that provides additional request header information. You may specify as many header information strings as you need.

Returns:

BLOB data – The actual file retrieved using the URL. If the function fails to make the connection, a blank value is returned.

Example:

HTTPGet('http://www.magicsoftware.com/idex.html', 'If-Modified-Since: Tue, 7 Aug 2001 12:00:00 GMT', 'User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)')

This example requests the file specified by the first parameter. The following parameters are samples of additional request header information.

The first parameter asks to retrieve the page only if it was modified after the provided date.

The second parameter provides the server with the type of user agent that this request simulates.

Note:

The HTTPGet function may 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 specifying the HTTP Timeout environment setting in the Magic.ini file.

When an HTML file or any textual data is retrieved, you may query the returned text stream using all 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:

HTTPPost

How Do I Retrieve a Web Page or other URL Content?

The Online and Rich Client Samples projects (program EL05 and REL05)

Reference
Attachment 
Attachment