void TestHTTP() { /* Test HTTP GET Code */ String testString = LoadResourceText.GetNetwork("http://introtoapps.com/datastore.php?action=list&appid=12345678", "GET"); DisplayAlert("Alert", "Test get: " + testString, "OK"); }
public static String GetResult(String p_action, String p_objectid, String p_serialized_json, String p_http_method = "GET") { String postResult; String URI; // The following switch allows the programmer to define an action in lamence terms and still function switch (p_action) { case ("save"): p_action = save_action; break; case ("load"): p_action = load_action; break; case ("list"): p_action = list_action; break; default: break; } //Define the full URI if (p_serialized_json == "") { URI = URL + p_action + AND + APPID + AND + OBJID + p_objectid; } else { URI = URL + p_action + AND + APPID + AND + OBJID + p_objectid + AND + "data=" + p_serialized_json; } //Do the HTTP POST request and get the result try { //Attempt to do the HTTP request postResult = LoadResourceText.GetNetwork(URI, p_http_method); } catch (Exception ex) { //Request failed (likely bad parameters) postResult = "Web request failed."; } return(postResult); }