• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

接口文件格式说明(asp+xmlhttp)_jquery

jquery 搞代码 7年前 (2018-06-12) 87次浏览 已收录 0个评论
接口xml文件格式
<info>
<rec>
       <depID>所属栏目</depID>
       <smallClassID>所属信息单位</smallClassID>
       <type>信息发布形式</type>
<keyWord>关键字</keyWord>
<title>新闻标题</title>
<author>作者</author>
<original>原出处</original>
<content>新闻内容</content>
</rec>
<rec>
       <depID>所属栏目</depID>
       <smallClassID>所属信息单位</smallClassID>
       <type>信息发布形式</type>
<keyWord>关键字</keyWord>
<title>新闻标题</title>
<author>作者</author>
<original>原出处</original>
<content>新闻内容</content>
</rec>
</info>
 
注:接口类型和数据注意事项。
 
字段名
名称
类型
数据取值说明
上传数据说明
depID
所属栏目
Int(4)
 
代码(不能为空)
smallClassID
所属信息单位
Nvarchar(25)
 
代码(不能为空)
type
信息发布形式
Nvarchar(7)
重要信息=1
弹出信息=2
热点信息=3
可复选多个,以“,”分隔
如:1,2,3
代码(多个用逗号分隔)
keyWord
关键字
Nvarchar(50)
多个以“,”分隔
如:keyword1,keyowrd2
文字(多个用逗号分隔)
title
新闻标题
Nvarchar(50)
文字
文字(不能为空)
author
作者
Nvarchar(20)
文字
文字
original
原出处
Nvarchar(20)
文字
文字
content
新闻内容
varChar (4000)
文字
文字(不能为空)
 
 
 
举例:
<info>
<rec>
       <depID>1</depID>
       <smallClassID>20040212200856429814</smallClassID>
       <type>1,3</type>
<keyWord>关键字1, 关键字2</keyWord> 
<title>新闻标题</title>
<author>作者</author>
<original>原出处</original>
<content>新闻内容</content>
</rec>
</info>
 
 
上传方法说明:
 
将上述产生的字符串发送到http://服务器IP:端口/receiveInfo.asp(必须用POST方式传送)
 
经测试通过代码如下:
 
发送端:sendInfo.asp
 
<%
set xmlhttp=Server.CreateObject(“MSXML2.ServerXMLHTTP”)
 
xmlstr=”<info><rec><depID>1</depID><smallClassID>20040212200856429814</smallClassID><type>1,3</type><keyWord>关键字1, 关键字2</keyWord><title>新闻标题</title><author>作者</author><original>原出处</original><content>新闻内容</content></rec></info>”
 
URL=”http://192.168.1.5:9020/receiveInfo.asp&#8221;
xmlhttp.open “POST”,URL, False
xmlhttp.send  xmlstr
if  err.number=0 then
       if xmlhttp.status <>”200″ then
              Response.Write “<font style=’font-size:12px;color:red’>状态:”&xmlhttp.status&” ;描述:”&xmlHttp.ResponseText&”</font>”
       else
              Response.Write “<font style=’font-size:12px;color:red’>  “&xmlHttp.ResponseText&”</font>”
       end if
else
       Response.Write “<font style=’font-size:12px;color:red’>状态:”&xmlhttp.status&” ;描述:”&xmlHttp.ResponseText&”</font>”
end if
%>
 
 
 
接收端:receiveInfo.asp
 
 
<%@codepage=936%>
<%
Server.ScriptTimeOut=99999
Response.Buffer =false
Response.CharSet=”gb2312″
set xmldoc=Server.CreateObject(“MSXML2.DOMDocument”)
 
xmldoc.load Request
 
set root = xmldoc.DocumentElement
 
for i=1 to xmldoc.documentelement.childNodes.length
 
Set recnote = xmldoc.documentelement.childNodes(i-1)
 
Set depIDnote = recnote.selectSingleNode(“depID”)
Set smallClassIDnote = recnote.selectSingleNode(“smallClassID”)
Set typenote = recnote.selectSingleNode(“type”)
Set keyWordnote = recnote.selectSingleNode(“keyWord”)
Set titlenote = recnote.selectSingleNode(“title”)
Set authornote = recnote.selectSingleNode(“author”)
Set originalnote = recnote.selectSingleNode(“original”)
Set contentnote = recnote.selectSingleNode(“content”)
 
response.Write depIDnote.text&”||”
response.Write smallClassIDnote.text&”||”
response.Write typenote.text&”||”
response.Write keyWordnote.text&”||”
response.Write titlenote.text&”||”
response.Write authornote.text&”||”
response.Write originalnote.text&”||”
response.Write contentnote.text&”||”
 
 
next
 
response.Write(“0”)
 
%>

欢迎大家阅读《接口文件格式说明(asp+xmlhttp)_jquery,跪求各位点评,若觉得好的话请收藏本文,by 搞代码


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:接口文件格式说明(asp+xmlhttp)_jquery
喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址