HTTP Reference
Http transfer
Script
Function
bool gkScript::fetchUrl(string url, string &response, map<string string>header = [])
Fetches a URL into a string
Samples:
var data = "";
gkScript.fetchUrl("https://www.dropbox.com/", data);
gkScript.fetchUrl("https://www.dropbox.com/", data, ["Accept-Charset": "utf-8", "Accept-Language": "en-US"]);HttpResponse Object
Script
Function
HttpResponse gkScript::httpRequest(string url, method httpMethod, map<string string>header = [], string requestBody = "")
Creates a HttpResponse class
The following methods are defined:
enum http_methods // supported methods for gkScript::httpRequest
{
GET,
POST,
HEAD,
PUT,
PATCH,
DELETE,
TRACE,
OPTIONS,
CONNECT
};HttpResponse class
Http transfer sample
The following sample is a combination of the script from Http transfer and HttpResponse Object. It uses both to get the headers of an URL. Then a GET method with range header to retrieve the first 100 bytes of the URL.
Last updated
Was this helpful?