高手,高手,高分呀,快来一个小问题

夜若 2008-06-24 04:12:02
如果有很多连接,是连接像土豆网上的视频
可是有一个问题,土豆经常更新
连接少的时候可以一个个检查连接目标是不是存在
可是如果有几千个,或是更多,那么那些连接不存在了要更新

可不可以帮我写一段可以 检查连接是否存在 的代码
...全文
66 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
Anlige 2008-06-24
  • 打赏
  • 举报
回复
下面函数调用~~

function GetResStr(URL)
dim ResBody,ResStr,PageCode,sta
Set Http=server.createobject("msxml2.serverxmlhttp.3.0")
Http.setTimeouts 10000, 10000, 10000, 10000
Http.open "GET",URL,False
Http.Send()
If Http.Readystate =4 Then
sta=Http.status
If sta=200 Then
GetResStr="页面正常"
elseif sta=404 Then
GetResStr="页面不存在"
elseif sta=500 then
GetResStr="URL服务器错误"
End If
End If
End Function

Anlige 2008-06-24
  • 打赏
  • 举报
回复
下面函数调用~~

function GetResStr(URL)
dim ResBody,ResStr,PageCode,sta
Set Http=server.createobject("msxml2.serverxmlhttp.3.0")
Http.setTimeouts 10000, 10000, 10000, 10000
Http.open "GET",URL,False
Http.Send()
If Http.Readystate =4 Then
sta=Http.status
If sta=200 Then
GetResStr="页面正常"
elseif sta=404 Then
GetResStr="页面不存在"
elseif sta=500 then
GetResStr="URL服务器错误"
End If
End If
End Function

学习a123456 2008-06-24
  • 打赏
  • 举报
回复
不学不行
jhwcd 2008-06-24
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 Anlige 的回复:]
可以试试xmlhttp组件~~~~
[/Quote]
Anlige 2008-06-24
  • 打赏
  • 举报
回复
下面函数调用~~

function GetResStr(URL)
dim ResBody,ResStr,PageCode,sta
Set Http=server.createobject("msxml2.serverxmlhttp.3.0")
Http.setTimeouts 10000, 10000, 10000, 10000
Http.open "GET",URL,False
Http.Send()
If Http.Readystate =4 Then
sta=Http.status
If sta=200 Then
GetResStr="页面正常"
elseif sta=404 Then
GetResStr="页面不存在"
elseif sta=500 then
GetResStr="URL服务器错误"
End If
End If
End Function

Anlige 2008-06-24
  • 打赏
  • 举报
回复
下面函数调用~~

function GetResStr(URL)
dim ResBody,ResStr,PageCode,sta
Set Http=server.createobject("msxml2.serverxmlhttp.3.0")
Http.setTimeouts 10000, 10000, 10000, 10000
Http.open "GET",URL,False
Http.Send()
If Http.Readystate =4 Then
sta=Http.status
If sta=200 Then
GetResStr="页面正常"
elseif sta=404 Then
GetResStr="页面不存在"
elseif sta=500 then
GetResStr="URL服务器错误"
End If
End If
End Function

Anlige 2008-06-24
  • 打赏
  • 举报
回复
下面函数调用~~

function GetResStr(URL)
dim ResBody,ResStr,PageCode,sta
Set Http=server.createobject("msxml2.serverxmlhttp.3.0")
Http.setTimeouts 10000, 10000, 10000, 10000
Http.open "GET",URL,False
Http.Send()
If Http.Readystate =4 Then
sta=Http.status
If sta=200 Then
GetResStr="页面正常"
elseif sta=404 Then
GetResStr="页面不存在"
elseif sta=500 then
GetResStr="URL服务器错误"
End If
End If
End Function

Dogfish 2008-06-24
  • 打赏
  • 举报
回复
用xmlhttp检测一下,是否返回404, 如果是404就是不存在。

Does a url exist?
Another simple use is finding if a url exists, in HTTP there are various status codes returned by both HEAD and GET requests, 200 means success, 404 means failure, and the others mean other things. See HTTP status codes for a full explanation. using the status property of the xmlhttp object provides you this status

xmlhttp.open("HEAD", "/faq/index.html",true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
if (xmlhttp.status==200) alert("URL Exists!")
else if (xmlhttp.status==404) alert("URL doesn't exist!")
else alert("Status is "+xmlhttp.status)
}
}
xmlhttp.send(null)
Anlige 2008-06-24
  • 打赏
  • 举报
回复
可以试试xmlhttp组件~~~~

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧