url_split
Split an URL (HTTP, HTTPS, FTP...)
Syntax
[proto, server, path, query, username, port, fragment] = url_split(URL);
Arguments
- URL
String: An URL. Supported and tested: HTTP, HTTPS, FTP (IPv4 and IPv6)
- proto
String: the protocol (ex: http, ftp, etc)
- server
String: the server (ex: www.scilab.org)
- path
String: the path (ex: /products/scilab)
- query
String: query (ex: ?SearchText=plot3d)
- username
String: username (ex: username:pass)
- port
int: port (ex: 80)
Note that if the port is not provided in the URL, the value will be 0.- fragment
String: fragment (ex: #chapter1)
The fragment is also called anchor and it is used to create a bookmark inside an HTML document.
Description
Split an URL by component
This function is based on the libxml2 library (in particular, the function xmlParseURI).
Examples
[proto, server, path, query, username, port, fragment] = url_split("http://xmlsoft.org/html/libxml-uri.html#xmlParseURI") [proto, server, path] = url_split("ftp://ftp.free.fr/pub/Distributions_Linux/debian/README") [a,b,c,d]=url_split("https://www.scilab.org/content/search?SearchText=plot")
See also
- http_get — HTTP GET request.
History
Versão | Descrição |
5.5.0 | Function splitURL() introduced |
2023.0.0 | Renamed url_split() . |
Report an issue | ||
<< toJSON | Web Tools | Ferramentas Windows >> |