惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
爱范儿
爱范儿
博客园 - 三生石上(FineUI控件)
Microsoft Security Blog
Microsoft Security Blog
Google DeepMind News
Google DeepMind News
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
GbyAI
GbyAI
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
V
V2EX
酷 壳 – CoolShell
酷 壳 – CoolShell
量子位
博客园_首页
T
Tailwind CSS Blog
aimingoo的专栏
aimingoo的专栏
A
About on SuperTechFans
T
The Blog of Author Tim Ferriss
Stack Overflow Blog
Stack Overflow Blog
Recent Announcements
Recent Announcements
P
Proofpoint News Feed
博客园 - 司徒正美
有赞技术团队
有赞技术团队
Engineering at Meta
Engineering at Meta
Last Week in AI
Last Week in AI
MongoDB | Blog
MongoDB | Blog

博客园 - 白天的萤火虫

Net开源框架/项目,你研究过几个? 主题:实用且不花哨的js代码大全 关于模拟注册登录的 字字带泪-写在三十岁到来这一天 关于silverlight的安装 推荐一个IE下的优秀js调试工具(Companion.JS) 给分页控件增加一列 编号 关于Ajax的web配置 - 白天的萤火虫 - 博客园 一个行转列的例子 最新Silverlight开发环境配置介绍 sql server中的存储过程调试 PetShop介绍集锦 DIV+CSS实现圆角 button 绑定 enter键 转载---使用Ajax实现DropDownList和ListBox的联动以及两个ListBox之间数据的移动 自己调试通过的存储过程 又一个通用分页存储过程,支持表别名,多表联合查询SQL语句--转载 写入和读取cookie CascadingDropDown从数据库中读取数据绑定到DropDownList控件上
获取HTML代码 - 白天的萤火虫 - 博客园
白天的萤火虫 · 2008-11-24 · via 博客园 - 白天的萤火虫

     1、用xmlhttp可以抓  
  2、用HttpWebRequest也可以  
   
  1:  
  public   string   StealUrl(string   URL)  
  {  
  MSXML2.ServerXMLHTTPClass   xmlhttp=new   MSXML2.ServerXMLHTTPClass();  
  xmlhttp.open("GET",URL,false,null,null);  
  xmlhttp.setRequestHeader("CONTENT-TYPE","text/xml;charset=gb2312");  
  xmlhttp.send(null);  
  return   System.Text.Encoding.GetEncoding("gb2312").GetString((byte[])xmlhttp.responseBody);  
  }  
  2:  
  System.Net.HttpWebRequest   request   =   (HttpWebRequest)HttpWebRequest.Create("http://www.xxx.com");                                  
  request.Accept   ="image/gif,   image/x-xbitmap,   image/jpeg,   image/pjpeg,   application/x-shockwave-flash,   application/vnd.ms-excel,   application/vnd.ms-powerpoint,   application/msword,   */*";  
               
  System.Net.HttpWebResponse   response   =   (HttpWebResponse)request.GetResponse();  
     
  Stream   myStream   =   response.GetResponseStream();  
  StreamReader   sr   =   new   StreamReader(myStream,     System.Text.Encoding.Default);  
       
  textBox1.Text   +=   sr.ReadToEnd();  
  myStream.Close();  
   
  替换就和替换字符串一样,具体的需求方法也不同,简单的用replace就行了,麻烦点的用正则表达式   
 

using MSXML2;

VS 2005的项目--添加引用--com--找到 microsofot xml v2.6,--确定