DecodeFromURL
Download JSON code from a file located on a website.
Call:
int ires = ts_json(int iJSONObjectDescr, "DecodeFromURL", string sURL);
Here:
iJSONObjectDescr - descriptor of an object of type JSON,
sURL - Internet address of the file.
Returns 0 on successful upload.
Example.
Download JSON code from config.json file from www.appcarrier.com
int iJSONConfig; // object descriptor
object("create", "ts_json", iJSONConfig); // create object in memory
int ires = ts_json(iJSONConfig, "DecodeFromURL", "http://www.appcarrier.com/config.json");
if (ires != 0)
{
cout << "JSON Decode from URL error";
}
else
{
cout << "File JSON decoded successfully\n";
}
object("delete", iJSONConfig); // delete object