Puts data to a URL.
PUTURL("url", "data", "header", "typestr", "cmdtype", bufsize)
"url" |
- |
A string, the source URL address. |
||||||
"data" |
- |
A string, the data string. Defaults to empty, no data. |
||||||
"header" |
- |
A string, the HTML header string.
Defaults to " |
||||||
"typestr" |
- |
Optional. A string. The returned data type: |
||||||
|
|
|
||||||
"cmdtype" |
- |
Optional A string. The HTML command. Defaults to "PUT". |
||||||
bufsize |
- |
Optional. An integer. The initial size of the HTML transfer buffer. Defaults to 65536. |
A string or series, the result of the HTML request.
(result, status, errmes) = PUTURL("url", "data", "header", "typestr", "cmdtype", bufsize) returns the value, integer status and error string.
url = "https://jsonplaceholder.typicode.com/posts/1";
hed = "Content-type: application/json; charset=UTF-8" + strescape("\r\n");
str = '{"id":1, "title":"A Title", "body":"A Body", "userId":200}';
jstr = puturl(url, str, hed);
Updates a simulated JSON store with the JSON object represented by str. To convert the returned JSON string to an object, use:
jobj = objjson(jstr);
PUTURL sends data to a URL as specified by header, typestr and cmdtype.
The result is buffered. The initial buffer size is doubled until it fits the result.
PUTURL is a low level routine for HTML data transfers.
See GETURL to obtain the contents of a URL.
See READJSON to load a JSON object from a file or URL.