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
The following methods are defined:
enumhttp_methods // supported methods for gkScript::httpRequest{ GET, POST, HEAD, PUT, PATCH, DELETE, TRACE, OPTIONS, CONNECT};
HttpResponse class
classHttpResponse{ statusCode; // unsigned int responseBody; // string responseHeader; // map of string:string pairsstringgetHeader(string header); // get response-header with case insensitive header name};
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.