public string GetPost(string url, params string[] data)
{
string tempMessage = "";
System.Net.WebClient WebClientObj = new System.Net.WebClient();
System.Collections.Specialized.NameValueCollection PostVars = new System.Collections.Specialized.NameValueCollection();
if (data.Length % 2 == 0)
{
for (int i = 0; i < (data.Length / 2); i++)
{
PostVars.Add(data[i * 2], data[i * 2 + 1]);
}
}
try
{
byte[] byRemoteInfo = WebClientObj.UploadValues(url, "POST", PostVars);
//下面都没用啦,就上面一句话就可以了
tempMessage = System.Text.Encoding.Default.GetString(byRemoteInfo);
//这是获取返回信息
}
catch
{
}
return tempMessage;
}