作者: wujizhishang
查看: 2575|回复: 8

[教程] 【代码】C#下载网页源码

[复制链接]
wujizhishang 发表于 2016-3-6 22:32:30 | 显示全部楼层 |阅读模式
查看: 2575|回复: 8
[C#] 纯文本查看 复制代码
using System.Net;
using System.IO;

namespace WebDownloadDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            WebClient web = new WebClient();
            string html = web.DownloadString("http://bbs.cskin.net");
            Console.WriteLine(html);
            Console.ReadKey();
        }
    }
}

评分

参与人数 1金钱 +3 收起 理由
乔克斯 + 3 感谢LZ对论坛做出的贡献~

查看全部评分

回复 论坛版权

使用道具 举报

乔克斯 发表于 2016-3-7 18:58:12 | 显示全部楼层
请勿将网上到处都是的代码贴上并设置付费浏览。本论坛所有贴均不要权限及付费浏览。
451205927 发表于 2016-3-7 11:13:34 | 显示全部楼层
what?看帖都要花钱?@乔克斯
Jowen 发表于 2016-3-7 13:10:23 | 显示全部楼层
里面的内容
using System.Net;
using System.IO;

namespace WebDownloadDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            WebClient web = new WebClient();
            Stream s = web.OpenRead(@"http://moni.51hupai.org/?new=2");
            StreamReader sr = new StreamReader(s);
            string line;
            while ((line =sr.ReadLine())!=null)
            {
                Console.WriteLine(line);

            }
            Console.ReadKey();
            sr.Close();
        }
    }
}
haode 发表于 2016-3-7 14:30:39 | 显示全部楼层
Jowen 发表于 2016-3-7 13:10
里面的内容
using System.Net;
using System.IO;

2金币的内容......
Jowen 发表于 2016-3-8 09:40:37 | 显示全部楼层
乔克斯 发表于 2016-3-7 18:58
请勿将网上到处都是的代码贴上并设置付费浏览。本论坛所有贴均不要权限及付费浏览。 ...

是的,没有规矩不成方圆
ingdear 发表于 2016-3-19 10:16:01 | 显示全部楼层
这个推荐用玄机的内裤去操作,贼方便了。
jacksonwong 发表于 2019-5-10 14:18:46 | 显示全部楼层
谢谢分享~~~
回复

使用道具 举报

cid1702 发表于 2021-8-16 21:29:53 | 显示全部楼层
谢谢分享~~
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 加入CSkin博客

本版积分规则

QQ|申请友链|小黑屋|手机版|Archiver|CSkin ( 粤ICP备13070794号

Powered by Discuz! X3.2  © 2001-2013 Comsenz Inc.  Designed by ARTERY.cn
GMT+8, 2024-4-16 20:55, Processed in 0.566371 second(s), 35 queries , Gzip On.

快速回复 返回顶部 返回列表