C#页面截取函数
来源:互联网 发布:如何抓取app数据 编辑:程序博客网 时间:2024/05/29 14:49
protected string GetPage(string Url,string Parameter,string StartTxt,string EndTxt)
{
HttpWebRequest oRequest = (HttpWebRequest)WebRequest.Create(Url);
oRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)";
string strPost = Parameter; ;
byte[] somebyte = Encoding.Default.GetBytes(strPost);
oRequest.Method = "POST";
oRequest.ContentLength = somebyte.Length;
oRequest.ContentType = "application/x-www-form-urlencoded";
StreamWriter oStreamWriter = new StreamWriter(oRequest.GetRequestStream(), System.Text.Encoding.GetEncoding("GB2312"));
oStreamWriter.Write(strPost);
oStreamWriter.Close();
HttpWebResponse oResponse = (HttpWebResponse)oRequest.GetResponse();
StreamReader sr = new StreamReader(oResponse.GetResponseStream(), System.Text.Encoding.GetEncoding("GB2312"));
string sResultContents = sr.ReadToEnd();
sr.Close();
oResponse.Close();
//截取所需要的部分
int start, stop;
start = sResultContents.IndexOf(StartTxt);
stop = sResultContents.IndexOf(EndTxt, start) + EndTxt.Length;
string temp = sResultContents.Substring(start, stop - start);
return temp;
}
- C#页面截取函数
- c#截取字符串函数
- C#中文字符截取函数
- C#字符串截取函数Substring
- Asp截取一个页面源代码函数
- Asp截取一个页面源代码函数
- C#字符串截取 和其他函数
- 用C#写的字符串截取函数
- 用C#写的字符串截取函数
- 用C#写的字符串截取函数
- 用C#写的字符串截取函数
- 【转载】C#写的字符串截取函数
- C#中英文混合字符串截取函数
- C# 中几个截取字符串的函数
- Delphi TWebBrowser 截取页面上Alert和Confirm函数
- C#自写函数-截取字符串某一长度并返回
- c#中自定义字符截取函数:Left、Right 、Mid
- C#中indexof和substring函数用法 (截取字符串)
- 解决JSP页面的中文乱码(2002年原创)
- 什么是冒烟测试 每日build
- 转: openwrt
- GetTypeHashCode() 没有找到适合的方法来重写
- 使用HttpWebRequest以及HttpWebResponse读取Http远程文件
- C#页面截取函数
- 存储过程和游标
- 发用Email
- vc中ShellExecute的使用方法
- 我与朗科不得不说的那些事儿
- 给你的AIR桌面添加橄榄球赛精彩片段
- 转:opwrt install
- C#域名查询
- asp.net中word转html碰到的权限异常问题