请大家点击 http://www.chineselovelinks.com/chinese/results/searchresults.cfm?searchtype=1&sortby=12&searchview=3&cache=1
打开后把鼠标放到一个人的姓名的位置,在看状态栏 有个链接
我想在后台获得这个链接串 怎么获得
打开后把鼠标放到一个人的姓名的位置,在看状态栏 有个链接
我想在后台获得这个链接串 怎么获得
解决方案 »
- asp.net 生成页面chart或是图表
- 最基本的问题的问题
- session超时后 如何清除 哈希表中的那一条记录
- 求一正则表达式,可以匹配SessionId的! ### 50分 ##################
- 为什么我的Session在即使有操作的情况下也会失效呢?
- ################## COM组件运行错误~高手帮忙~在线等待!!~~100分 ##########################
- Asp.net/C#/Sql语句问题?
- 郁闷呀,救命呀
- asp.net技术问题???
- 请问关于数据库查询的问题
- 急求获取DataList控件中的文本框的值的问题
- repeater ItemDataBound中,如何判断已经输出到了最后一条记录?
var obj=document.getElementsByTagName("a");
for(var i = 0;i<obj.length;i++)
{
var ahref=obj[i]; //获取推荐链接
document.writeln(ahref.innerText+" "+ahref["href"]+"<br>");
}
我就是要获得这个也的http://www.chineselovelinks.com/chinese/results/searchresults.cfm?searchtype=1&sortby=12&searchview=3&cache=1
不是获得本地的
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("地址");
req.Credentials = new NetworkCredential("用户名", "密码", "域名");
req.Method = "GET";
IAsyncResult ir = req.BeginGetResponse(null, null);
ir.AsyncWaitHandle.WaitOne();
try {
HttpWebResponse response1 = (HttpWebResponse)req.EndGetResponse(ir);
System.IO.Stream stream = response1.GetResponseStream();
sReader = new System.IO.StreamReader(stream, System.Text.Encoding.GetEncoding("GB2312"));
if (null != sReader) {
string pattern = @"<a(?:\s*?)href=['|""](?<url>[\s\S]+?)['|""]>(?<title>[\s\S]+?)</a>";
System.Text.RegularExpressions.MatchCollection matchs = System.Text.RegularExpressions.Regex.Matches(sReader.ReadToEnd(), pattern);
if (matchs.Count <= 0)
Response.Write("没有匹配项");
else
{
Response.Write("链接:" + matchs[i].Groups["url"].Value+"<br />");
}
}
}
}
catch (System.Exception ex) {
Response.Write(ex.Message);
}
finally {
if (null != sReader) {
sReader.Dispose();
}
}
System.Net.HttpWebRequest quest=(System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(URL);
System.Net.HttpWebResponse sponse =(System.Net.HttpWebResponse)quest.GetResponse();
StreamReader reader=new StreamReader(sponse.GetResponseStream(),Encoding.GetEncoding("GB2312"));
string str;
str=reader.ReadToEnd();string strPattern=@"a[\s]+href=(? <Link>[^\s>]+)[^>]*>(? <Text>[^ <]*) </a>";
MatchCollection Matches=Regex.Matches(str,strPattern,RegexOptions.IgnoreCase|RegexOptions.Compiled);
foreach(Match NextMatch in Matches)
{
string URL=NextMatch.Groups["Link"].Value.ToString().Trim();
string URLText=NextMatch.Groups["Text"].Value.ToString().Trim();
Response.Write(URL);
Response.Write(URLText);
}