//private static String api_root_url = "http://www.leqeewechat.com/device/"; public static String commonTest() { Dictionary <string, string> parameters = new Dictionary <string, string>(); parameters.Add("sid", (UserSessionAgent.token == null?"":UserSessionAgent.token)); int k = new Random().Next(); HttpWebResponse response = NetworkAgent.theEN().postHttp("http://www.leqeewechat.com:8080/wms/appIndex", parameters, 30000, "Sinri Variable UA-" + k, Encoding.UTF8); //HttpWebResponse response = NetworkAgent.theEN().getHttp(url, parameters, 30000); StreamReader sr = new StreamReader(response.GetResponseStream()); String content = sr.ReadToEnd(); return(content); }
private static String callApi(String api_sub_url, Dictionary <string, string> parameters) { parameters.Add("sid", (UserSessionAgent.token == null ? "" : UserSessionAgent.token)); string url = (APIWorkerImpl.api_root_url + api_sub_url);// +".php"; Console.WriteLine("CALL_API: " + url); foreach (String key in parameters.Keys) { Console.WriteLine("param| " + key + " : " + parameters[key]); } HttpWebResponse response = NetworkAgent.theEN().postHttp(url, parameters, 10 * 1000, null, Encoding.Default); //response = NetworkAgent.theEN().getHttp(url, parameters, 30000); StreamReader sr = new StreamReader(response.GetResponseStream()); String content = sr.ReadToEnd(); Console.WriteLine(content); response.Close(); return(content); }