技术社区

c#获取html内容
admin | 发表于: 2017-12-22 回答
我自己写的,用WebClient访问,为什么不能访问下面的链接呢?提示不能连接远程服务器
static void Main(string[] args)
{
            WebClient MyWebClient = new WebClient();
            Byte[] html = MyWebClient.DownloadData("https://detail.1688.com/offer/44007847996.html?spm=0.0.0.0.1P0sGD");    //获取html
            string  pageHtml = Encoding.Default.GetString(html);
          //此处插入正则匹配,获取价格……略……还没学会
           Console.WriteLine(pageHtml);    //显示下载的html
           Console.Read();
}
我目的是想从阿里巴巴某件商品网页自动获取商品价格,跪求前辈指点……

回复列表