复制代码 代码如下:
private string strFireWallIP
...{
get
...{
return System.Configuration.ConfigurationSettings.AppSettings["strFireWallIP"];
}
}
private string strFireWallPort
...{
get
...{
return System.Configuration.ConfigurationSettings.AppSettings["strFireWallPort"];
}
}
private string strUID
...{
get
...{
return System.Configuration.ConfigurationSettings.AppSettings["strUID"];
}
}
private string strPWD
...{
get
...{
return System.Configuration.ConfigurationSettings.AppSettings["strPWD"];
}
}
private string strDomain
...{
get
...{
return System.Configuration.ConfigurationSettings.AppSettings["strDomain"];
}
}
#endregion
方法:
获取指定远程网页内容
复制代码 代码如下:
/**//// <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;
}
获取指定远程网页元素字节数组::
获取指定远程网页元素字节数组#region 获取指定远程网页元素字节数组
复制代码 代码如下: