Skip to content

API UO HTTP_Get en

Codex edited this page Oct 3, 2026 · 1 revision

UO.HTTP_Get

Русский · English · Українська · Deutsch · Français · Italiano · Español · 繁體中文 · 日本語 · 한국어

UO.HTTP_Get · UO.HTTP_Post · UO.HTTP_Body · UO.HTTP_Header

ClassicUO • Runtime API

Downloads HTTP/HTTPS data, such as settings from your service or a file. It does not control the game connection or execute downloaded code.

Exact syntax

UO.HTTP_Get(URL:Any) -> Unit
UO.HTTP_Get(URL:Any, LStream:Any) -> Unit

Parameters

  • URL — Required String: an absolute http:// or https:// address. Replace example.com with your service. No game connection is required; the process uses its normal network connection, not the profile's game proxy.
  • LStream — Optional MemoryStream() or File(path) object. Omitted, 0 or Nothing selects text through HTTP_Body(). A stream receives raw bytes, replacing its entire previous content; MemoryStream rewinds to position 0. File(path) overwrites that file; its parent directory must exist. Any other argument type raises an error before sending the request.

Returns

Unit — no return value. Use a separate statement, not a Boolean, ID or byte count. Read text through HTTP_Body(), or binary data from the supplied stream.

Behavior

  • The last response belongs to the current script runtime. Its next GET/POST replaces it; other concurrent scripts do not. It is not saved in the profile. Copy body and headers to local variables before another request if needed.
  • GET/POST wait in the executing script thread. One 20-second deadline covers the request and body read. Stopping the script cancels the wait; HTTP_Body/HTTP_Header never wait. The whole response is buffered in memory even with File; this is not streaming for large downloads.
  • Response charset controls text decoding; missing/unknown charset falls back to UTF-8. HTTP 4xx/5xx bodies are read too. A network failure/timeout logs an error and empties body and headers; Try/Catch does not replace checking the expected response. Script cancellation propagates. Local file-write or argument errors may be caught by Try/Catch.
  • GET without a stream updates text and headers. Stream GET writes bytes, clears HTTP_Body and keeps headers. Empty responses and network failures replace stream content with empty data. To preserve an existing file, download into MemoryStream and validate first.

Internal functions: from call to result

These are actual client stages, not extra UO commands. GET/POST call HttpRequest; HTTP_Body/HTTP_Header only read its result within their runtime.

1. ExecuteClientApiCompatibility

GET without a stream updates text and headers. Stream GET writes bytes, clears HTTP_Body and keeps headers. Empty responses and network failures replace stream content with empty data. To preserve an existing file, download into MemoryStream and validate first.

Unit — no return value. Use a separate statement, not a Boolean, ID or byte count. Read text through HTTP_Body(), or binary data from the supplied stream.

Project source: external/InjectionScript/src/InjectionScript/Runtime/InjectionApiUO.cs; function ExecuteClientApiCompatibility.

2. HttpRequest

GET/POST wait in the executing script thread. One 20-second deadline covers the request and body read. Stopping the script cancels the wait; HTTP_Body/HTTP_Header never wait. The whole response is buffered in memory even with File; this is not streaming for large downloads.

Response charset controls text decoding; missing/unknown charset falls back to UTF-8. HTTP 4xx/5xx bodies are read too. A network failure/timeout logs an error and empties body and headers; Try/Catch does not replace checking the expected response. Script cancellation propagates. Local file-write or argument errors may be caught by Try/Catch.

Project source: src/ClassicUO.Client/Game/Managers/ClassicUOInjectionApiBridge.cs; function HttpRequest.

These are actual client stages, not extra UO commands. GET/POST call HttpRequest; HTTP_Body/HTTP_Header only read its result within their runtime.

Examples

Read a mana threshold from settings

# Read a mana threshold from settings
#
# Downloads HTTP/HTTPS data, such as settings from your service or a file. It does not control
# the game connection or execute downloaded code.
#
# Unit — no return value. Use a separate statement, not a Boolean, ID or byte count. Read text
# through HTTP_Body(), or binary data from the supplied stream.

SUB Main()
    # Expects a JSON object containing minMana. A number from 0 to 100 is converted to Integer;
    # empty/malformed data or an invalid field falls back to 30. This is a script setting, not the
    # character's current mana.
    # The example.com URLs are illustrative and do not provide this service. Replace them with your
    # endpoints; running an example performs real HTTP requests. No game actions are performed.

    UO.HTTP_Get("https://example.com/basic-config.json")
    Try
        Dim config = JsonParse(UO.HTTP_Body())
        Dim threshold = config.Get("minMana", 30)
        If IsNumeric(threshold) Then
            If threshold >= 0 AndAlso threshold <= 100 Then
                Return CInt(threshold)
            End If
        End If
    Catch problem
    End Try
    Return 30
END SUB

Parameter and execution notes:

  • Expects a JSON object containing minMana. A number from 0 to 100 is converted to Integer; empty/malformed data or an invalid field falls back to 30. This is a script setting, not the character's current mana.
  • The example.com URLs are illustrative and do not provide this service. Replace them with your endpoints; running an example performs real HTTP requests. No game actions are performed.

Download bytes before saving

# Download bytes before saving
#
# Downloads HTTP/HTTPS data, such as settings from your service or a file. It does not control
# the game connection or execute downloaded code.
#
# Unit — no return value. Use a separate statement, not a Boolean, ID or byte count. Read text
# through HTTP_Body(), or binary data from the supplied stream.

SUB Main()
    # MemoryStream receives undecoded bytes. Empty data is not saved; nonempty data overwrites
    # download.bin in the working directory. True only confirms saving nonempty data, not a valid
    # file format. Add expected-content validation for actual use.
    # The example.com URLs are illustrative and do not provide this service. Replace them with your
    # endpoints; running an example performs real HTTP requests. No game actions are performed.

    Dim data = MemoryStream()
    Using data
        UO.HTTP_Get("https://example.com/route-data.bin", data)
        If data.Length() = 0 Then
            Return False
        End If
        data.SaveToFile("download.bin")
        Return True
    End Using
END SUB

Parameter and execution notes:

  • MemoryStream receives undecoded bytes. Empty data is not saved; nonempty data overwrites download.bin in the working directory. True only confirms saving nonempty data, not a valid file format. Add expected-content validation for actual use.
  • The example.com URLs are illustrative and do not provide this service. Replace them with your endpoints; running an example performs real HTTP requests. No game actions are performed.

Write directly to a file

# Write directly to a file
#
# Downloads HTTP/HTTPS data, such as settings from your service or a file. It does not control
# the game connection or execute downloaded code.
#
# Unit — no return value. Use a separate statement, not a Boolean, ID or byte count. Read text
# through HTTP_Body(), or binary data from the supplied stream.

SUB Main()
    # File names http-download.bin in the working directory. GET overwrites it even for an empty
    # response. Using releases the object; Main returns headers, not file validity.
    # The example.com URLs are illustrative and do not provide this service. Replace them with your
    # endpoints; running an example performs real HTTP requests. No game actions are performed.

    Dim output = File("http-download.bin")
    Using output
        UO.HTTP_Get("https://example.com/route-data.bin", output)
    End Using
    Return UO.HTTP_Header()
END SUB

Parameter and execution notes:

  • File names http-download.bin in the working directory. GET overwrites it even for an empty response. Using releases the object; Main returns headers, not file validity.
  • The example.com URLs are illustrative and do not provide this service. Replace them with your endpoints; running an example performs real HTTP requests. No game actions are performed.

Clone this wiki locally