.Net简易爬虫
来源:互联网 发布:淘宝客佣金10% 编辑:程序博客网 时间:2024/06/18 13:36
无聊之际,就随便写了一个爬虫,分享给大家。
public Form1() { InitializeComponent(); } Thread th = null; private void Form1_Load(object sender, EventArgs e) { this.Text = "0"; } private void btn_Begion_Click(object sender, EventArgs e) { th = new Thread(new ParameterizedThreadStart(InstanceMethod)); th.Start(txt_Url.Text); } public delegate void del(string s); public void InstanceMethod(object obj) { del de = new del(this.Test); var MyHttpWebReauest = (HttpWebRequest)WebRequest.Create(obj.ToString()); MyHttpWebReauest.Method = "Post"; MyHttpWebReauest.ContentType = "application/x-www-form-urlencoded"; MyHttpWebReauest.ContentLength = 0; MyHttpWebReauest.UserAgent = @"Mozilla/5.0 (iPhone; U; CPU like Mac OS X; en)"; MyHttpWebReauest.AllowAutoRedirect = true; Stream stream = MyHttpWebReauest.GetResponse().GetResponseStream(); StreamReader reader = new StreamReader(stream, Encoding.GetEncoding("utf-8")); BeginInvoke(de, reader.ReadToEnd()); reader.Close(); stream.Close(); Thread.Sleep(1000); } public void Test(string obj) { txt_zhi.Text = obj; } private void Form1_FormClosed(object sender, FormClosedEventArgs e) { th.Abort(); }
第一次写博客,很多地方不懂,欢迎大家批评指正,谢谢!联系QQ:1831996117.加好友注明是博客。
阅读全文
1 0
- .Net简易爬虫
- 简易爬虫
- 简易爬虫
- Python简易的爬虫
- 简易的网络爬虫
- 简易Java爬虫制作
- 简易网络爬虫
- 简易文本爬虫
- Python初级简易爬虫
- java简易爬虫
- nodejs简易爬虫
- python简易爬虫制作
- python简易爬虫
- java简易爬虫Crawler
- java简易爬虫Crawler
- nodejs简易爬虫
- Golang实战【简易爬虫】
- python简易爬虫
- 1sting(JAVA大数+ 递推)
- 自定义title
- 关于EditText的输入小数点计算问题
- 面向对象编程-定义类
- IOCP模型总结
- .Net简易爬虫
- 跳表的介绍与实现
- C基础
- 最长公共子串等最字问题
- android UiAutomator生成报告类基本方法封装
- Android 获取 当前日期的前后n天的实现
- yii2 gradview 输出当前时间和图片
- 一次组件化的实践
- LVM (逻辑盘卷管理)