【问题标题】:How to xml read from url with Asp.NET如何使用 Asp.NET 从 url 读取 xml
【发布时间】:2015-02-23 02:02:58
【问题描述】:

如何获取此链接中的 XML 代码

https://www.betorder.com/GetLiveScore?qq=62642&sportTypeId=1&fid=0&lang=TR&countryId=all&checkBoxSelected=all

我正在尝试,但它没有

public void sonucAl() 
{
    string adres = "https://www.betorder.com/GetLiveScore?qq=62642&sportTypeId=1&fid=0&lang=TR&countryId=all&checkBoxSelected=all";
    WebRequest gelenIstek = HttpWebRequest.Create(adres);
    WebResponse gelenCevap;
    using (gelenCevap = gelenIstek.GetResponse())
    {
        using (StreamReader donenDeger = new StreamReader(gelenCevap.GetResponseStream()))
        {
            string gelenBilgi = donenDeger.ReadToEnd();
            string gonder = gelenBilgi;
            div.InnerHtml = gonder;
        }
    }
}

【问题讨论】:

标签: c# asp.net xml httpwebrequest


【解决方案1】:

我认为您正在寻找的内容可以在以下帖子中找到:

How to load XML from URL on XmlDocument()

根据个人经验并根据上面帖子中的示例,以下是加载 xml 的方式:

string m_strFilePath = "https://www.betorder.com/GetLiveScore?qq=62642&sportTypeId=1&fid=0&lang=TR&countryId=all&checkBoxSelected=all";
XmlDocument myXmlDocument = new XmlDocument();
myXmlDocument.Load(m_strFilePath); //Load NOT LoadXml

【讨论】:

    猜你喜欢
    • 2021-05-05
    • 2012-08-28
    • 2012-09-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多