以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  【已解决】[求助]请问狐表能写http的请求吗?钉钉群机器人  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=134990)

--  作者:zto001
--  发布时间:2019/5/14 16:47:00
--  【已解决】[求助]请问狐表能写http的请求吗?钉钉群机器人
[求助]请问狐表能写http的请求吗?
[此贴子已经被作者于2019/5/16 17:32:46编辑过]

--  作者:有点甜
--  发布时间:2019/5/14 16:57:00
--  

参考

 

http://www.foxtable.com/mobilehelp/scr/0163.htm

 


--  作者:zto001
--  发布时间:2019/5/15 21:53:00
--  
在哪个地方写?位置是哪?

这个http:地址发起HTTP POST 请求,写的是这串代码吗?

2、在客户端项目的命令窗口执行下面的代码,会提示服务器收到的数据:

Dim hc As New HttpClient("http://127.0.0.1/test.htm")
hc
.Timeout = 5 \'设置超时为5秒
hc
.Content = "我是Foxtable"
Dim
 ret As String = hc.GetData()
MessageBox
.Show(ret)



--  作者:有点甜
--  发布时间:2019/5/16 8:55:00
--  
直接做一个按钮,然后写代码就可以了啊
--  作者:有点甜
--  发布时间:2019/5/16 8:56:00
--  
请具体说明你要做什么,和什么对接,实现什么功能。
--  作者:zto001
--  发布时间:2019/5/16 9:39:00
--  
这代码怎么写?
Dim hc As New HttpClient("https://oapi.dingtalk.com/robot/send?access_token=5a5c4ab46953f33575654b30df86092531e907eec0826c3516a2fccbfd9877d1")
hc.Timeout = 5 \'设置超时为5秒
hc.C
Dim ret As String = hc.GetData()
MessageBox.Show(ret)


地址:https://oapi.dingtalk.com/robot/send?access_token=5a5c4ab46953f33575654b30df86092531e907eec0826c3516a2fccbfd9877d1

做钉钉自定义机器人https://open-doc.dingtalk.com/microapp/serverapi2/qf2nxq

需要向这个地址发起HTTP POST 请求

发出文字

--  作者:有点甜
--  发布时间:2019/5/16 10:53:00
--  
Dim hc As New HttpClient("https://oapi.dingtalk.com/robot/send?access_token=5a5c4ab46953f33575654b30df86092531e907eec0826c3516a2fccbfd9877d1")
hc.C
hc.Timeout = 5 \'设置超时为5秒
hc.Content = "{\'msgtype\': \'text\',\'text\': {\'content\': \'我就是我, 是不一样的烟火\'}}"
Dim ret As String = hc.GetData()
MessageBox.Show(ret)

--  作者:zto001
--  发布时间:2019/5/16 11:30:00
--  
同样的代码,为什么你发送成功了,我没发送成功?我是不是缺少了什么东西?


"C"不是“HttpClient”的成员
错误代码:hc.C


我去掉hc.C之后提示

{"errmsg":"无效的HTTP HEADER Content-Type","errcode":43004}

--  作者:zto001
--  发布时间:2019/5/16 11:33:00
--  
43004错误代码应该是因为请求头中的content-type是否正确    是Content-Type: application/json这个

请求头是啥

--  作者:有点甜
--  发布时间:2019/5/16 11:41:00
--  
Dim hc As New HttpClient("https://oapi.dingtalk.com/robot/send?access_token=5a5c4ab46953f33575654b30df86092531e907eec0826c3516a2fccbfd9877d1")
hc.contentType = "application/json"
hc.Timeout = 5 \'设置超时为5秒
hc.Content = "{\'msgtype\': \'text\',\'text\': {\'content\': \'我就是我, 是不一样的烟火\'}}"
Dim ret As String = hc.GetData()
MessageBox.Show(ret)