Skip to content

kiwi.net.URL

Nikos Siatras edited this page Nov 1, 2022 · 3 revisions

The URL class represents a Uniform Resource Locator, a pointer to a "resource" on the World Wide Web. A resource can be directory, or it can be a reference to a more complicated object, such as a query to a database or to a search engine.

URL.getHost()

function URL.getHost() as String

Get the host part of this URL.
@return the authority part of this URL

Example Code:

#include once "kiwi\kiwi.bi"
#include once "kiwi\net.bi" 

Dim address as URL = URL("https://freebasic.net/wiki/DocToc")
print "Host:" & address.getHost()

Output:

freebasic.net

URL.getPath()

function URL.getPath() as String

Gets the path part of this URL.
@return the path part of this URL, or an empty string if one does not exist

Example Code:

#include once "kiwi\kiwi.bi"
#include once "kiwi\net.bi" 

Dim address as URL = URL("https://freebasic.net/wiki/DocToc")
print "Path:" & address.getPath()

Output:

/wiki/DocToc

URL.getProtocol()

function URL.getProtocol() as String

Gets the protocol name of this URL.
@return the protocol of this URL.

Example Code:

#include once "kiwi\kiwi.bi"
#include once "kiwi\net.bi" 

Dim address as URL = URL("https://freebasic.net/wiki/DocToc")
print "Protocol:" & address.getProtocol()

Output:

https