|
ParseURL function
Internet utilities |
|
| acInet
|
| function ParseURL(URL: String; var Protocol, HostName, URLPath,
|
| Username, Password, ExtraInfo: String; var Port: Word): Boolean;
|
| The ParseURL procedure divides the URL string (in) to Protocol, HostName, URLPath (path and file name), Username, Password, ExtraInfo (GET query) and PortNumber values.
|
|
|
| The URL location should be specified in following form:
|
| [protocol://][username:password@]hostname[[:port]/urlpath][?extra]
|
| examples:
|
| http://www.appcontrols.com/download/diskcontrols_trial.exe
|
| utilmind.com:80
|
| https://secure.element5.com/register.html?productid=140005
|
| file://c:/windows/desktop/page.html
|
| http://hello:world@www.utilmind.com/locked/topsecret.zip
|
|
|
| ParseURL('https://secure.element5.com/register.html?productid=140005', Protocol, HostName, URLPath, ExtraInfo, PortNumber);
|
| { Results:
|
| Protocol = "https"
|
| HostName = "secure.element5.com"
|
| URLPath = "/register.html"
|
| ExtraInfo = "?productid=140005"
|
| PortNumber = 443 (default port for secure (SSL) connection )
|
| }
|
| ParseURL('utilmind.com', Protocol, HostName, URLPath, ExtraInfo, PortNumber);
|
| { Results:
|
| Protocol = "http"
|
| HostName = "utilmind.com"
|
| URLPath = ""
|
| ExtraInfo = ""
|
| PortNumber = 80 (default port for HTTP protocol)
|
| }
|
| ParseURL('hello:world@www.utilmind.com/cgi-bin/locked/test.cgi?test', Protocol, HostName, URLPath, ExtraInfo, PortNumber);
|
| { Results:
|
| Protocol = "http"
|
| HostName = "www.utilmind.com"
|
| URLPath = "/cgi-bin/locked/test.cgi"
|
| ExtraInfo = "?test"
|
| PortNumber = 80
|
| }
|
| ParseURL('file://c:/windows/desktop/page.html', Protocol, HostName, URLPath, ExtraInfo, PortNumber);
|
| { Results:
|
| Protocol = "file"
|
| HostName = ""
|
| URLPath = "c:\windows\desktop\page.html"
|
| ExtraInfo = ""
|
| PortNumber = 0 (local file)
|
| }
|
| acHTTP component.
|