下面是一段代碼: 添加System.IO和System.Net和System.Xml
WebRequest webrequest =WebRequest.Create("http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency=USD&ToCurrency=INR");
HttpWebResponse response = (HttpWebResponse)webrequest.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
XmlDocument doc = new XmlDocument();
doc.LoadXml(responseFromServer);
string value = doc.InnerText;
MessageBox.Show(value);
reader.Close();
dataStream.Close();
response.Close();
選擇一個代碼作爲基礎,並在其上執行其餘的操作 – Mackintoast 2012-02-16 12:53:20
看看System.Net.WebRequest - 它應該做你想做的事:http://msdn.microsoft.com/en-us/library /system.net.webrequest.aspx。如果遇到任何問題,請使用代碼更新您的問題,並指出您遇到的具體問題。 – AlexCuse 2012-02-16 12:55:05