index-asp.asp
上传用户:taiyokogyo
上传日期:2022-04-20
资源大小:365k
文件大小:2k
- <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
- <%
- ''''''''''''''''''''''
- '参数配置
- ''''''''''''''''''''''
- Const SearchPortal="http://www.test.com/totindex.aspx" '淘特搜索引擎索引接口地址
- Const IndexKey="totsearchengine01" '接口访问key,请通过搜索引擎中的web.config查找
- '==================================================================
- '提交数据
- '==================================================================
- Function PostHttpPage(loginUrl,loginActUrl,PostData,CharSets)
- Dim xmlHttp
- Dim RetStr
- Set xmlHttp = CreateObject("Microsoft.XMLHTTP")
- xmlHttp.Open "POST", loginActUrl, False
- XmlHTTP.setRequestHeader "Content-Length",Len(PostData)
- xmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
- ' xmlHttp.setRequestHeader "Referer", loginUrl
- xmlHttp.Send PostData
- If Err.Number <> 0 Then
- Set xmlHttp=Nothing
- response.Write("提交出错!提交数据:"&PostData)
- Exit Function
- End If
- PostHttpPage=BytesToBstr(xmlHttp.responseBody,CharSets)
- Set xmlHttp = nothing
- End Function
- '========================================================================
- '字符编码函数
- '========================================================================
- Function BytesToBstr(body,code)
- dim objstream
- set objstream = Server.CreateObject("adodb.stream")
- objstream.Type = 1
- objstream.Mode =3
- objstream.Open
- objstream.Write body
- objstream.Position = 0
- objstream.Type = 2
- objstream.Charset =code
- BytesToBstr = objstream.ReadText
- objstream.Close
- set objstream = nothing
- End Function
- dim ret
- '添加索引
- ret=PostHttpPage(SearchPortal,SearchPortal,"key="&IndexKey&"&action=insert&id=1&Title=测试&Content=test&Categoryid=0&Summary=test&Photo=a&ModDate=2010-1-1&LinkUrl=test","utf-8")
- response.Write(ret)
- response.Write("<br>")
- '删除索引
- ret=PostHttpPage(SearchPortal,SearchPortal,"key="&IndexKey&"&action=delete&id=1","utf-8")
- response.Write(ret)
- %>