C#从url获取带参数的Html代码

时间:2017-11-04 18:57:47

标签: c# http parsing

例如,使用此网址 http://www.rzjets.net/aircraft/index.php?registry=F-OLRC&frstatus=1

我想解析结果页面。

我正在使用这些代码,但我的结果是空的:

            var urlRzjetsNoParameters = "http://www.rzjets.net/aircraft/index.php";
            string result;

            using (var client = new WebClient()) {
                client.QueryString.Add("registry",reg);
                client.QueryString.Add("frstatus","1");
                result = client.DownloadString(urlRzjetsNoParameters);
            }

            var urlRzjets = "http://www.rzjets.net/aircraft/index.php?registry={0}&frstatus=1";
            var url = string.Format(urlRzjets, Uri.EscapeDataString(reg));
            using (var client = new WebClient())
            {
                result = client.DownloadString(url);
            }

如果您可以帮助我

0 个答案:

没有答案