Split an URL (HTTP, HTTPS, FTP...)
[proto, server, path, query, username, port, fragment] = splitURL(URL);
String: An URL. Supported and tested: HTTP, HTTPS, FTP (IPv4 and IPv6)
String: the protocol (ex: http, ftp, etc)
String: the server (ex: www.scilab.org)
String: the path (ex: /products/scilab)
String: query (ex: ?SearchText=plot3d)
String: username (ex: username:pass)
int: port (ex: 80)
![]() | Note that if the port is not provided in the URL, the value will be 0. |
String: fragment (ex: #chapter1)
The fragment is also called anchor and it is used to create a bookmark inside an HTML document.
Split an URL by component
This function is based on the libxml2 library (in particular, the function xmlParseURI).
Version | Description |
5.5.0 | Function splitURL() introduced |