Foxtable(狐表)用户栏目专家坐堂 → [求助]发送post请求不成功


  共有4127人关注过本帖树形打印复制链接

主题:[求助]发送post请求不成功

帅哥哟,离线,有人找我吗?
jerry727869905
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:79 积分:1030 威望:0 精华:0 注册:2012/11/19 16:03:00
[求助]发送post请求不成功  发帖心情 Post By:2021/5/29 22:05:00 [只看该作者]

  1. 游览器: General
  2. Request URL:
    http://10.188.192.222:7705/apiv1/salerecord/query/
  3. Request Method:
    POST
  4. Status Code:
    200 OK
  5. Remote Address:
    10.188.192.222:7705
  6. Referrer Policy:
    strict-origin-when-cross-origin
  7. Response Headers
    1. Access-Control-Allow-Credentials:
      true
    2. Access-Control-Allow-Origin:
      http://10.188.192.222:8080
    3. Content-Length:
      12978
    4. Content-Type:
      application/json
    5. Vary:
      Origin
  8. X-Frame-Options:
    SAMEORIGIN Request Headers
    1. Accept:
      text/html,application/xhtml+xml,application/json,;q=0.9,image/webp,*/*;q=0.8,application/x-www-form-urlencoded
    2. Accept-Encoding:
      gzip, deflate
    3. Accept-Language:
      zh-CN,zh;q=0.9
    4. api-key:
      ef4e5c3f1643a6d9984c856f6e8fa9bb
    5. Connection:
      keep-alive
    6. Content-Length:
      89
    7. Content-Type:
      application/x-www-form-urlencoded
    8. Host:
      10.188.192.222:7705
    9. Origin:
      http://10.188.192.222:8080
    10. Referer:
      http://10.188.192.222:8080/
      User-Agent:
      Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36
    Form Data
  9. meal_filter:
    [1,2,3]
  10. date_filter:
    ["2021-05-28"]
  11. machine_filter:
    [3,6] ---------------------------------------------------------------------------------------------------------------- 代码1: Dim url As String = "http://10.188.192.222:7705/apiv1/summary/sheet/" Dim msg As String = "meal_filter=[1,2,3]&date_filter=[""2021-05-28""]&machine_filter=[3,6]" 'msg = msg.replace("&", "%26") '增加这个也没有用 output.show(msg) Dim hc As New HttpClient(url) hc.Headers.Add("Content-Type","application/x-www-form-urlencoded") hc.Headers.Add("api-key","ef4e5c3f1643a6d9984c856f6e8fa9bb") hc.content = msg Dim result = hc.GetData msgbox(result)
  12. 代码2:
      Dim url As String = "http://10.188.192.222:7705/apiv1/summary/sheet/"
      Dim msg As String = "meal_filter=[1,2,3]&date_filter=[""2021-05-28""]&machine_filter=[3,6]"
        Dim req = System.Net.WebRequest.Create(url)


        req.Method = "POST"
        req.Timeout = 5000
        req.C
        req.UserAgent = "Mozilla/5.0 (Windows NT 6.3; rv:66.0) Gecko/20100101 Firefox/66.0"

        Dim aryBuf As Byte() = Encoding.GetEncoding("utf-8").GetBytes(msg)
        req.ContentLength = aryBuf.Length
        Dim writer = req.GetRequestStream()
        writer.Write(aryBuf, 0, aryBuf.Length)
        writer.Close()
        writer.Dispose()
        Dim pos = req.GetResponse
        Dim stm As System.IO.Stream = pos.GetResponseStream()
        Dim reader As New System.IO.StreamReader(stm)
        Dim str As String = reader.ReadToEnd
        pos.Close
        stm.Close
        reader.close

        output.show(str)

        两端代码都无法正确发送post请求(返回
        {"state_code": -1, "msg": "\u8ba4\u8bc1\u5931\u8d25", "data": "\u8bf7\u5148\u767b\u5f55"}
        ),请问大神应该如何修改?谢谢指导!

 回到顶部
帅哥,在线噢!
有点蓝
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110495 积分:562359 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/5/30 20:25:00 [只看该作者]

接口开发文档或者链接发上来看看

 回到顶部
帅哥哟,离线,有人找我吗?
jerry727869905
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:79 积分:1030 威望:0 精华:0 注册:2012/11/19 16:03:00
  发帖心情 Post By:2021/5/31 21:11:00 [只看该作者]

蓝老师,这个链接是在公司内网的,通过游览器查询数据,我想通过foxtable做一个可以自动查询发送信息到邮箱的功能,没有接口文档。

图片点击可在新窗口打开查看此主题相关图片如下:1.png
图片点击可在新窗口打开查看


 回到顶部
帅哥,在线噢!
有点蓝
  4楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110495 积分:562359 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/5/31 22:04:00 [只看该作者]

如果是自己做的服务端,那么把服务端代码发上来

 回到顶部
帅哥哟,离线,有人找我吗?
jerry727869905
  5楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:幼狐 帖子:79 积分:1030 威望:0 精华:0 注册:2012/11/19 16:03:00
  发帖心情 Post By:2021/6/1 21:12:00 [只看该作者]

不是自己做的服务端,是跟其他公司购买的,安装在公司内网的服务器上,现在只能通过手动网页查询,要用foxtable自动查询。

 回到顶部
帅哥,在线噢!
有点蓝
  6楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:110495 积分:562359 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/6/1 22:01:00 [只看该作者]

咨询对方要开发文档,或者了解对方接收数据的模式,如果没有,没有办法做

 回到顶部