asp post json串

hopfish 2014-12-18 06:56:01
请问asp如何post json串到另一位置
...全文
276 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
csdn_aspnet 2014-12-23
  • 打赏
  • 举报
回复
ASP模拟POST提交数据的方法
Author:flymorn Source:飘易
Categories:Asp编程 PostTime:2009-4-7 13:21:40
正 文:
   有时需要获取远程网站的某些信息,而服务器又限制了GET方式,只能通过POST数据提交,这个时候我们可以通过asp来实现模拟提交post数据,飘易加工了下面的部分代码,比如获取IP138的IP数据地址信息,代码如下:
<%
On error resume next '容错处理
 

Function GetBody(ips) '飘易-获取远程IP地址POST信息
Set https = Server.CreateObject("MSXML2.XMLHTTP") 
With https 
.Open "Post", "http://www.ip138.com/ips8.asp", False
.setRequestHeader "Content-Type","application/x-www-form-urlencoded"
.Send "ip="&ips&"&action=2"
GetBody = .ResponseBody
End With 
GetBody = BytesToBstr(GetBody,"GB2312")
Set https = Nothing 
End Function
 

Function BytesToBstr(body,Cset) '飘易:转换GB2312
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 = Cset
BytesToBstr = objstream.ReadText 
objstream.Close
set objstream = nothing
End Function
 

Response.Write GetBody("61.186.177.105")
%>
hopfish 2014-12-23
  • 打赏
  • 举报
回复
我做的是微信的公众平台的 http请求方式: POST https://api.weixin.qq.com/customservice/kfaccount/add?access_token=ACCESS_TOKEN POST数据说明 POST数据示例如下: { "kf_account" : test1@test, "nickname" : “客服1”, "password" : "pswmd5", } 其它的都能post上去,就是这个post不上去
zywandy 2014-12-22
  • 打赏
  • 举报
回复
Set Retrieval = Server.CreateObject("Msxml2.ServerXMLHTTP.3.0") Retrieval.open "POST", subUrl1, False, "", "" Retrieval.send() ResponseTxt1 = Retrieval.responseText Set Retrieval = Nothing 直接POST就好
Dogfish 2014-12-20
  • 打赏
  • 举报
回复
普通post就可以啦。只是看你怎么处理而已。
xcgh 2014-12-19
  • 打赏
  • 举报
回复
就是表单的post,json字符串直接发送即可
slwsss 2014-12-18
  • 打赏
  • 举报
回复

28,391

社区成员

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

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