Garry's Mod Wiki

HTTP

  boolean HTTP( table parameters )

Description

Launches an asynchronous http request with the given parameters.

This cannot send or receive multiple headers with the same name.

Issue Tracker: 2232
HTTP-requests that respond with a large body may return an unsuccessful error. Try using the Range header to download the file in chunks.
HTTP-requests to destinations on private networks (such as 192.168.0.1, or 127.0.0.1) won't work.
To enable HTTP-requests to destinations on private networks use Command Line Parameters -allowlocalhttp. (Dedicated servers only)

Arguments

1 table parameters
The request parameters. See HTTPRequest structure.

Returns

1 boolean
true if we made a request, nil if we failed.

Example

HTTP( { failed = function( reason ) print( "HTTP request failed", reason ) end, success = function( code, body, headers ) print( "HTTP request succeeded", code, body, headers ) end, method = "GET", url = "https://google.com/" } )