auto defaultUserAgent

Default user agent for network requests.

deprecated
ubyte[] getRaw(string url)

Simple GET request to raw content.

Returns

Byte array.

ubyte[] get(string url, long timeoutMilliseconds = -1, string userAgent = defaultUserAgent)

GET request to raw content.

Parameters

url

Resource address.

timeoutMilliseconds

Request execution timeout in milliseconds. If -1, timeout is not used.

userAgent

User agent.

Returns

Byte array.

ubyte[] get(string url, HTTP client)

GET request to raw content.

Parameters

url

Resource address.

client

Prepared std.net.curl.HTTP structure.

Returns

Byte array.

T[] post(T = char)(const(char)[] url, string[string] postDict, HTTP conn = HTTP()) 
if (is(T == char) || is(T == ubyte))

POST request.

ubyte[] postRaw(const(char)[] url, string[string] postDict, HTTP c = HTTP())

POST request to get an answer with raw content.

Returns

Byte array.

string[string] getHeaders(in char[] url)

Gets HTTP response headers by URL.

string getContentType(in char[] url)

Gets HTTP content type by URL.

string getCharset(const(char)[] url)

Gets content charset (possibly empty) by URL.

bool isLinkToHTML(string url)

Checks if the URL is a link to HTML page.

deprecated
UniString getPage(string url)

Get text content as amalthea.encoding.UniString by URL.

UniString getText(string url, long timeoutMilliseconds = -1, string userAgent = defaultUserAgent)

Get text content as amalthea.encoding.UniString by URL.

Parameters

url

Resource address.

timeoutMilliseconds

Request execution timeout in milliseconds. If -1, timeout is not used.

userAgent

User agent.

Returns

text response.

auto getElementsByTag(string html, string tag)

This function searches all elements from HTML page with a specific tag.

auto getElementsByTagAndAttribute(
    string html, 
    string tag, 
    string attrName = "", 
    string attrValue = ""
)

This function searches all elements by a specific tag and an attribute.

Returns

Page element info (tag name and possible attributes) and content of the element as tuple with two elements.

string getHTMLPageTitle(string url)

This function returns title of Internet-page.

ref string replaceSpecialMnemonics(return ref string htmlText)

Search and replace special characters in HTML for normal view.

Some useful functions based on std.net.curl.

Public imports