Purpose:Execute a simple URL and retrieve metadata information using WSCurl.
Liquid UI Code:// SAPLSMTR_NAVIGATION.E0100.sjsload('wscurl');
// Function to execute a simple URL and retrieve informationfunction simple_http() {
var wsCurl = new Curl();
/* Build the URL to make a call*/ var completeURL = "
http://www.guixt.com/";
/* Note this use is for calls made to www.guixt.com which returns us the JSON object in string*/ wsCurl.setopt(Curl.CURLOPT_URL, completeURL);
/* You can check the return code to avoid error data string which can be found from "wsCurl.error"
* return value 0 means success*/ var response = wsCurl.exec();
var error = wsCurl.error;
z_tmp = response.substring(0,2000);
copytext({"fromstring":"z_tmp", "totext":"z_text"});
/* Close the http connection for the URL fetch*/ wsCurl.close();
/* Remove any reference for Garbage Collection*/ wsCurl= NULL;
}
// User Interfaceclearscreen();
pushbutton([1,0], 'WWW.GUIXT.COM', '?',{"size":[1,15], "process":simple_http});
text([3,1], "http Details below - ");
textbox([4,1], [24, 100],{"name":"z_text"});
See attachments for code samples!