http post接口的实现问题?
protected void btnLoad_Click(object sender, EventArgs e){
//入口地址为:http://125.208.3.12:8888/sms.aspx
string url="http://125.208.3.12:8888/sms.aspx?action=overage&userid=1152&account=111&password=111";
Response.ClearContent();
Response.Write(Post(urll));
Response.End();
}
public string Post(string url)
{
string returnData = null;
try
{
HttpWebRequest webReq = (HttpWebRequest)WebRequest.Create(url);
webReq.Method = "POST";
webReq.ContentType = "application/x-www-form-urlencoded";
Stream postData = webReq.GetRequestStream();
postData.Close();
HttpWebResponse webResp = (HttpWebResponse)webReq.GetResponse();
Stream answer = webResp.GetResponseStream();
StreamReader answerData = new StreamReader(answer);
returnData = answerData.ReadToEnd();
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
return returnData.Trim()+"\n";
}
现在的问题是它return是xml形式的string,我怎样得到它标签里边的值?还有如果post(string url)的url改为入口地址,那参数怎么办,这方法又该怎么写?小生不才,望同业好手指点迷经,小弟在线等..