HTTPPage

Command group Flag affected Reversible Execute on client Platform(s)
External commands YES NO NO All

Syntax

HTTPPage (url[,service|port,verify {Default kTrue}]) Returns html-text

Description

Note: The flag is set according to whether Omnis was able to make a call to this external command.

This Web command is multi-threaded, allowing another thread to execute in the multi-threaded server while it runs. Note that the same socket cannot safely be used concurrently by more than one thread.

HTTPPage is a client command that retrieves the content of the Web page specified by the URL, into an Omnis Character or Binary variable.

Note: HTTPPage allows you to get HTML text source through a server, transparently and without additional coding.

URL is an Omnis Character field containing a standard Web page URL of the form http://domaininfo.xxx/path/webpagepage. If you are using a secure connection, the URL must be prefixed with https://.

Service|Port is an optional parameter that specifies the service name or port number of the server. If you specify a service name, the lookup for the port number occurs locally. If you omit this argument, it defaults to the port number specified in the URL, or if none is present, it defaults to 80 or 443, the default port for HTTP or HTTPS respectively.

The primary role of HTTPPage is to grab, simply and quickly, the HTML text source of the page specified by the URL. The URL may also specify a CGI name and arguments, but it is simpler to access CGIs by using the HTTPPost or HTTPGet functions.

If an error occurs, the command returns a negative number to Page. Otherwise, Page receives the contents of the specified URL. In other words, it receives the complete HTTP response for the URL, including the status line and the headers. Possible error codes are listed in the Web Command Error Codes Appendix.

Example

; Read the html content from lURL into the character variable lHtmlPage
Calculate lUrl as 'http://www.omnis.net/news/index.html'
HTTPPage (lUrl) Returns lHtmlPage