|
<< Click to Display Table of Contents >> Navigation: 3. Script Language > Internet and Network > HTP. - HTTP Operations |
SPR Script Language
HTP. Command Overview
Lists all available HTP. commands for HTTP operations.
Intention
The HTP. namespace in SPR provides a suite of commands for performing HTTP operations, such as sending requests, managing errors, setting timeouts, and configuring proxies. This overview lists all available HTP. commands, offering a quick reference for their purposes and linking to detailed documentation for each.
It’s your robot’s HTTP toolbox—everything you need to connect, debug, and manage web requests in one place.
Command List
Command |
Description |
Clear the last error state, optionally clearing history. |
|
Convert response content based on Content-Type (simplified). |
|
Return the last error message as text. |
|
Return the error message text for a given error code. |
|
Normalize and return the HTTP request type. |
|
Return the User-Agent string for a given index. |
|
Initialize HTTP headers with API key and content type. |
|
Execute a specified action with a value on the MCP server, returning the result code. |
|
Send an "END" signal to terminate the MCP server, returning success status. |
|
Initialize the MCP server, optionally with a config file. |
|
Request permission from the MCP server with a request string, optional timeout, returning result and response. |
|
Send a signal to the MCP server with a type and optional data, returning the queue index. |
|
Start the MCP server in a separate thread, initializing it with an optional config file if not already initialized, returning the thread handle. |
|
Shut down the MCP server and clean up resources. |
|
Perform a simplified HTTP request using static defaults. |
|
Perform a full HTTP request with all parameters. |
|
Set the connection timeout value in milliseconds. |
|
Switch Debug for Connection on. |
|
Set static defaults. |
|
Construct Header from Parameter. |
|
Set the proxy server name and bypass list. |
|
Set the receive timeout value in milliseconds. |
|
Set the DNS resolve timeout value in milliseconds. |
|
Set the send timeout value in milliseconds. |
|
Set the overall timeout value in milliseconds. |
|
Convert String to UTF8. |
|
Enable or disable proxy usage. |

In this Sample we access "LM Studio" a Local running LLM. You can see how we can preserve the Emojis using PSJ.Get Last ResultW and CLB.Set Uni Text.
Sample Code
' This code will access LM-Studio, a local running LLM.
$$URB=http://localhost:1234/
$$REA=api/v0/completions
VAV.$$URL=$$URB$$REA
HTP.InitHdr|-|-
' Add if token is needed
HTP.AddHdr|Authorization|Bearer your-valid-token-here
$$JSO={"model": "gemma-3-27b-it", "prompt": "Send me some nice emojis."}
$$CMD=POST
HTP.Setdebug|0
HTP.SetTO|36000
HTP.Request|$$CMD|$$URL|$$JSO|-|0|0|0|$$RET
PSJ.Parse|-|$$DOC
$$PAT=choices[0].text
PSJ.GetStr|$$DOC|$$PAT|$$TEX
MBX.$$TEX
PSJ.GetLastResultW|$$TEA
CLB.Set Unitext|$$TEA
' Please paste the Clipboard now into a Page like Twitter/X etc. and check the Emojis.
PSJ.FreeAll
ENR.
Remarks
- Commands are designed for use in SPR scripts to manage HTTP interactions.
- Each command links to a detailed help page for syntax and examples.
- Use HTP.SetDebug to enable verbose output for troubleshooting.
Limitations
- Some commands may require prior configuration (e.g., proxy settings).
See also: