<!--#include file="../init.asp"-->
<%
Function getHTTPPage(url)
On error resume next
Dim http
Set http=createobject("MSXML2.XMLHTTP")
Http.open "GET",url,false
Http.send()
If Http.readystate<>4 Then
Exit Function
End If
getHTTPPage=bytes2BSTR(Http.responseBody)
Set http=Nothing
If err.number<>0 Then err.Clear
End Function
Function bytes2BSTR(vIn)
Dim strReturn
Dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function
Function Get_SerialNumber(dataTable,datadb,MaxSerial)
Set SN_rs=Server.CreateObject("ADODB.Recordset")
SN_Sql="Select "&MaxSerial&" From "&dataTable&" Order by "&datadb&" Desc"
SN_rs.Open SN_Sql,Cn,1,1
If SN_rs.Eof And SN_rs.Bof Then
Get_SerialNumber = Serial_Number
Else
Get_SerialNumber = SN_rs(0)+1
End If
SN_rs.Close
Set SN_rs = Nothing
Get_SerialNumber = Get_SerialNumber
End Function
'//改变状态
If Request("action") = "establish" Then
System_Collect = Request.Form("System_Collect")
If System_Collect = 1 Then
System_Collect = 0
Else
System_Collect = 1
End If
rs.Open "Select System_Collect From G_System",Cn,1,3
If Not(rs.Eof And rs.Bof) Then
rs("System_Collect") = System_Collect
rs.Update
rs.Close
Response.Redirect("infocj.asp")
Response.End()
End If
End If
Function post_Add(strTable,strSegment,strID)
Cn.Execute("Update "&strTable&" Set "&strSegment&"="&strSegment&"+1 Where ID="&strID)
End Function
System_Collect=cn.execute("Select System_Collect from [G_System]")(0)
If System_Collect=1 Then
SystemSql="Select * From [G_System] Where ID = 1"
Rs.Open SystemSql,Cn,1,1
OldGoods_Time=Rs("OldGoods_Time")
News_Time=Rs("News_Time")
Rs.Close
If Dateadd("n",5,OldGoods_Time)<Now() Then
Redim Olds(10)
Dim Old
Old=getHTTPPage("
http://app.ntonline.cn/imarket/c_.asp?page=1")
Old=mid(Old,instr(Old,"日期"))
Old=mid(Old,1,instr(Old,"页次"))
For i = 0 To 9
Old=mid(Old,instr(Old,"#EEEEEE"+20))
Olds(i)=mid(Old,instr(Old,"href=")+6,instr(Old," title")-instr(Old,"href=")-7)
Next
For i = 0 To 9
If cn.execute("Select count(Info_ID) from [G_Info] where Info_CreateTime > '"&dateadd("m",-1,now())&"' and Info_UrlSource = '"&"
http://app.ntonline.cn/imarket/"&Olds(i)&"'")(0) = 0 Then
Old=getHTTPPage("
http://app.ntonline.cn/imarket/"&Olds(i))
Old=mid(Old,1,instr(Old,"发布人"))
Old=mid(Old,instr(Old,"信息分类:"))
Old=mid(Old,instr(Old,"fontBlue")+10)
Sorts=trim(mid(Old,1,instr(Old,"</td>")-1))
Old=mid(Old,instr(Old,"信息类型:"))
Old=mid(Old,instr(Old,"<td>")+4)
Types=trim(mid(Old,1,instr(Old,"</td>")-1))
Old=mid(Old,instr(Old,"信息标题:"))
Old=mid(Old,instr(Old,"<td>")+4)
Topic=trim(mid(Old,1,instr(Old,"</td>")-1))
Old=mid(Old,instr(Old,"padding-left:20px"))
Old=mid(Old,instr(Old,">")+1)
Content=trim(mid(Old,1,instr(Old,"</td>")-1))
Old=mid(Old,instr(Old,"联系人:"))
Old=mid(Old,instr(Old,"<td>")+4)
Lianxi=trim(mid(Old,1,instr(Old,"</td>")-1))
Old=mid(Old,instr(Old,"联系电话:"))
Old=mid(Old,instr(Old,"<td>")+4)
Dianhua=trim(mid(Old,1,instr(Old,"(<a")-1))
Old=mid(Old,instr(Old,"联系邮箱:"))
Old=mid(Old,instr(Old,"<td>")+4)
Email=trim(mid(Old,1,instr(Old,"</td>")-1))
Old=mid(Old,instr(Old,"联系地址:"))
Old=mid(Old,instr(Old,"<td>")+4)
Addr=trim(mid(Old,1,instr(Old,"</td>")-1))
Max_Info_Number = Get_SerialNumber("G_Info","Info_ID","Info_Number")
iSql = "Select * From G_Info"
rs.Open iSql,Cn,1,3
rs.AddNew
rs("Info_User_ID") = 0
rs("Info_Number") = Max_Info_Number
rs("Class_Frist") = 2
Get_tclass=0
If instr(Types,"
出售")>0 Then
rs("Class_Second") = 13
rs("Type_Number") = 1
If instr(Sorts,"
手机通信")>0 Then Get_tclass=38
If instr(Sorts,"电脑数码")>0 Then Get_tclass=53
If instr(Sorts,"汽车交通")>0 Then Get_tclass=36
If instr(Sorts,"家用电器")>0 Then Get_tclass=46
If instr(Sorts,"文化音像")>0 Then Get_tclass=39
If instr(Sorts,"礼品收藏")>0 Then Get_tclass=47
If instr(Sorts,"其他信息")>0 Then Get_tclass=34
If instr(Sorts,"运动休闲")>0 Then Get_tclass=49
If instr(Sorts,"家居服饰")>0 Then Get_tclass=45
If Get_tclass=0 Then Get_tclass=54
Else
rs("Class_Second") = 14
rs("Type_Number") = 2
If instr(Sorts,"手机通信")>0 Then Get_tclass=59
If instr(Sorts,"电脑数码")>0 Then Get_tclass=74
If instr(Sorts,"汽车交通")>0 Then Get_tclass=57
If instr(Sorts,"家用电器")>0 Then Get_tclass=67
If instr(Sorts,"文化音像")>0 Then Get_tclass=60
If instr(Sorts,"礼品收藏")>0 Then Get_tclass=68
If instr(Sorts,"其他信息")>0 Then Get_tclass=55
If instr(Sorts,"运动休闲")>0 Then Get_tclass=70
If instr(Sorts,"家居服饰")>0 Then Get_tclass=66
If Get_tclass=0 Then Get_tclass=76
End If
rs("Class_Three") = Get_tclass
Info_ContactWay=Dianhua&"/"&Email
rs("Info_ContactWay") = Info_ContactWay
rs("Info_ContactMan") = Lianxi
rs("Info_Password") = "888333"
rs("Info_Topic") = Topic
rs("Info_Content") = Topic&Info_ContactWay&Lianxi&Addr&Content
rs("Info_PicturePath") = ""
rs("Info_CreateTime") = dateadd("s",i,Now())
rs("Info_Top") = 0
rs("Info_DisplayTime") = Date()+7&" 23:59:59"
rs("Info_VistersTime") = dateadd("s",i,Now())
rs("Info_Displays") = 0
rs("Info_ZhongJie") = 0
rs("Info_Auditing") = 0
rs("Info_UrlSource") = "
http://app.ntonline.cn/imarket/"&Olds(i)
rs.Update
'//提取最后ID
MainInof_ID = rs("Info_ID")
rs.Close
'//写入子表[G_OldGoods]
bSql = "Select * From G_OldGoods"
rs.Open bSql,Cn,1,3
rs.AddNew
rs("MainInof_ID") = MainInof_ID
rs("Goods_User_ID") = 0
rs("Goods_Title") = Topic
rs("Goods_Content") = Content
rs("Goods_Degree") = "二手"
rs("Goods_Rental") = 0
rs("Goods_Deliver") = "双方联系"
rs("Goods_Address") = Addr
rs("Goods_Piece") = 1
rs.Update
rs.Close
Call post_Add("G_Class","Class_Times",2)
If instr(Types,"出售")>0 Then
Call post_Add("G_Class","Class_Times",13)
Else
Call post_Add("G_Class","Class_Times",14)
End If
Call post_Add("G_Class","Class_Times",Get_tclass)
End If
Next
SystemSql="Select * From [G_System] Where ID = 1"
Rs.Open SystemSql,Cn,1,3
rs("OldGoods_Time")=now()
Rs.update
Rs.Close
End If
End If
%>
<
html xmlns="
http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" c />
<title>无标题文档</title>
<link href="../font.css" rel="stylesheet" type="text/css">
</head>
<body >
<table width="100%" border="0" align=center cellpadding="0" cellspacing="0">
<tr>
<td width="37%" height="25" align="left"><img src="/vip/images/ico_arrowPos.gif" width="11" height="11" /><font class="t5"> 当前位置:信息管理 → 信息采集</font></td>
<td width="63%" align="left"> </td>
</tr>
</table>
<table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="150"> </td>
</tr>
<tr>
<td align="center" valign="middle"><fieldset style="margin:0px; margin-bottom:5px;">
<legend>信息采集</legend>
<table width="170" border="0" cellspacing="0" cellpadding="0">
<form action="infocj.asp?action=establish" method="post" name="myform">
<input type="hidden" name="System_Collect" id="System_Collect" value="<%=System_Collect%>">
<tr>
<td height="50" align="center" class="style1"><div align="center">采集状态:
<input type="submit" name="Submit" value="<% If System_Collect=1 Then Response.Write("采集已开启") Else Response.Write("采集已关闭") End If%>" title="点击将改变相反状态" style="height:20px; width:80px;">
</div></td>
</tr>
</form>
</table>
<%
n=cn.execute("Select count(Info_ID) from [G_Info] where Info_Auditing = 0 and Info_Displays = 0")(0)
%>
<table width="170" height="20" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="30"><div align="center" class="style1">有 <span class="style2"><%=n%></span> 条信息未审核[<a href="Javascript:window.location.reload()" class="style1">刷新</a>]</div></td>
</tr>
</table>
</fieldset></td>
</tr>
</table>
</body>
</html>
我采集的是
http://app.ntonline.cn/imarket/c_.asp?page=1上的数据,采集出错-HTTP 500 - 内部
服务器错误
望高手指点一二