Did you know ... | Search Documentation: |
Predicate parse_url/2 |
url:
, an
identifier separated from the remainder of the URL using :.
parse_url/2 assumes the http
protocol if no protocol is
specified and the URL can be parsed as a valid HTTP url. In
addition to the RFC-1738 specified protocols, the file
protocol is supported as well.ftp
, http
and file
protocols. If no path appears, the
library generates the path /
.?
, normally used to transfer data from HTML forms that
use the HTTP GET method. In the URL it consists of a
www-form-encoded list of Name=Value pairs. This is mapped to
a list of Prolog Name=Value terms with decoded names and
values.#
character.The example below illustrates all of this for an HTTP URL.
?- parse_url('http://www.xyz.org/hello?msg=Hello+World%21#x', P). P = [ protocol(http), host('www.xyz.org'), fragment(x), search([ msg = 'Hello World!' ]), path('/hello') ]
By instantiating the parts-list this predicate can be used to create a URL.