获取远程网页的内容之二(downmoon原创)
来源:互联网 发布:淘宝怎么将银行卡绑定 编辑:程序博客网 时间:2024/05/22 06:33
本机直接上网时,请参看
获取远程网页的内容之一(downmoon原创)
本文仅针AD下代理上网的情况:
代码如下:
1、定义变量:
定义变量
方法:
获取指定远程网页内容
/// <summary>
/// 获取指定远程网页内容
/// </summary>
/// <param name="strUrl">所要查找的远程网页地址</param>
/// <returns></returns>
//[WebMethod(Description = "获取指定远程网页内容。")]
public string getPageContent(string strUrl)
{
string strResult = "";
this.CurrentUrl = strUrl;
if(this.CurrentUrl.ToLower().StartsWith("http://")==false)
this.CurrentUrl = "http://"+this.CurrentUrl;
try
{
contentBytes = GetHtmlByte(CurrentUrl);
}
catch(Exception err)
{
strResult = "请求错误:" + err.Message;
}
if(contentBytes==null)
{
throw new Exception("没有获得返回值");
}
strResult = getStringFromByteArray(contentBytes,Encoding.UTF8);
return strResult;
}
/// 获取指定远程网页内容
/// </summary>
/// <param name="strUrl">所要查找的远程网页地址</param>
/// <returns></returns>
//[WebMethod(Description = "获取指定远程网页内容。")]
public string getPageContent(string strUrl)
{
string strResult = "";
this.CurrentUrl = strUrl;
if(this.CurrentUrl.ToLower().StartsWith("http://")==false)
this.CurrentUrl = "http://"+this.CurrentUrl;
try
{
contentBytes = GetHtmlByte(CurrentUrl);
}
catch(Exception err)
{
strResult = "请求错误:" + err.Message;
}
if(contentBytes==null)
{
throw new Exception("没有获得返回值");
}
strResult = getStringFromByteArray(contentBytes,Encoding.UTF8);
return strResult;
}
获取指定远程网页元素字节数组::
获取指定远程网页元素字节数组
转换指定字节数组为字符串::
转换指定字节数组为字符串
借用这个,写了个抽取中国天气网预报的服务!很爽!
在webForm中WebRequest/WebClient/WebBrowser获取远程页面源码的三种方式(downmoon)
- 获取远程网页的内容之二(downmoon原创)
- 获取远程网页的内容之一(downmoon原创)
- 获取远程网页的内容之一(downmoon原创)
- 同一域名对应多个IP时,PHP获取远程网页内容的函数[原创]
- 获取远程网页内容
- c#远程获取网页内容
- c#远程获取网页内容
- c#远程获取网页内容
- PHP远程获取网页内容
- asp获取远程网页的指定内容的实现代码
- c#远程获取网页内容及乱码问题的解决办法
- DNS轮询 PHP获取远程网页内容的函数
- c#远程获取网页内容及乱码问题的解决办法 .
- DNS轮询 PHP获取远程网页内容的函数
- 分享几段获取远程网页内容的php代码。
- delphi 入门之《获取网页的内容》
- 如何搜索木马隐藏的系统文件(downmoon原创)
- c#远程获取网页内容_c#应用
- javaScript技术参考
- 札记
- 为高速网络使用select
- 使用MSCOMM控件移植问题
- servlet通过JDBC连接数据库
- 获取远程网页的内容之二(downmoon原创)
- 深入Python
- javasript的checkbox的一个问题
- 很多年前,那个少年的初恋……
- servlet中文处理问题
- iptables基础教程
- 鱼和水的故事--完整版
- 练手2
- 换个角度思考:div+css布局入门