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,--确定