HTTPSplitURL

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

Syntax

HTTPSplitURL (url,hostname,uriReturns status

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.

HTTPSplitURL is a server and client function which splits a full URL into a hostname and a path (that is, a URI). Useful for following HREF links on pages.

URL is an Omnis Character field containing a standard Web page URL of the form http://host.mydomain.com/path/webpage.html. If you are using a secure connection, the URL must be prefixed with https://.

Hostname is an Omnis character field that receives the hostname parsed out of the URL argument. For example, given the URL, above, the hostname portion would be host.mydomain.com

URI is an Omnis Character field that receives URI parsed out of the URL. For example, given the URL, above, the URI would be /path/webpage.html.

The command returns an integer status, which is less than zero if an error occurs. Possible error codes are listed in the Web Command Error Codes Appendix.

Example

; Split lUrl into lHostname and lUri
Calculate lUrl as 'http://www.omnis.net/news/index.html'
HTTPSplitURL (lUrl,lHostName,lUri) Returns lStatus
;; lHostName = www.omnis.net, lUri = /news/index.html