• 按键公众号 :
按键精灵电脑版
立即下载

软件版本:2014.06
软件大小:22.9M
更新时间:2021-12-03

按键精灵安卓版
立即下载

软件版本:4.2.0
软件大小:45M
更新时间:2025-11-06

按键精灵iOS版
立即下载

软件版本:2.4.2
软件大小:29.2M
更新时间:2025-09-24

按键手机助手
立即下载

软件版本:4.5.0
软件大小:242M
更新时间:2025-11-06

快捷导航

登录 后使用快捷导航
没有帐号? 注册

发新话题 回复该主题

test [复制链接]

1#
现在官方自带的http的命令少了个提交文件的功能,美中不足¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
无可奈何我就被迫营业封装了一个http的插件,可以支持upload功能¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
目前插件还是内测版本,功能不完善且概率存在一定BUG,后续会进行迭代更新¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
功能特色
    ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  • 自定义header消息头¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  • 智能判定Content-Type类型¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  • 支持Android&IOS双端使用¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  • 统一的payload格式传入(table类型)¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
命令功能¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
SHTTP.Get(url, opts)
    ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  • 功能:发送Get请求¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  • 参数:¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
      ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
    • url: 必选,请求的url¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
    • opts: 可选参数,包含以下参数的键值表headers: 自定义http消息头,可以是键值表或者字符串timeout: 请求超时时间,默认为10秒files: 上传文件路径¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  • 返回:返回请求结果¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
SHTTP.Post(url, data, opts)
    ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  • 功能:发送Get请求¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  • 参数:¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
      ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
    • url: 必选,请求的url¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
    • data: 必选,需要提交的请求数据,用键值表或者key-value存放提交数据¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
    • opts: 可选参数,包含以下参数的键值表headers: 自定义http消息头,可以是键值表或者字符串timeout: 请求超时时间,默认为10秒files: 上传文件路径¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  • 返回:返回请求结果¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
使用范例¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
简单的Get网页
  1. Import "SHTTP.lua"¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  2. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  3. TracePrint SHTTP.Get("http://bbs.anjian.com/")¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  4. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
复制代码
附带请求头Get
  1. Import "SHTTP.lua"¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  2. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  3. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  4. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  5. Dim tHeaders = {null}¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  6. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
复制代码
发送post请求
  1. Import "SHTTP.lua"¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  2. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  3. Dim sUrl= "https://api.toolnb.com/Tools/Qrcode/qrcodeLogo.html"¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  4. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
复制代码
  1. Import "SHTTP.lua"¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  2. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  3. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  4. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  5. Dim tHeaders = {null}¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  6. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  7. tHeaders["user-agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36"¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  8. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
复制代码
通过post来提交文件
  1. Import "SHTTP.lua"¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  2. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  3. Dim sUrl= "https://api.toolnb.com/Tools/Qrcode/qrcodeLogo.html"¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  4. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
复制代码
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
对接百度OCR识别API
  1. Dim sUrl = "https://aip.baidubce.com/oauth/2.0/token"¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  2. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  3. Dim tData = {null}¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  4. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  5. tData["grant_type"] = "client_credentials"¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  6. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  7. tData["client_id"] = "" // 填自己的client_id¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  8. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  9. tData["client_secret"] = "" // 填自己的client_secret¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  10. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  11. Dim sJson, tJson¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  12. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  13. // 获取api的access_token值¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  14. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  15. sJson = SHTTP.Post(sUrl, tData)¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  16. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  17. tJson = Cjson.Decode(sJson)¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  18. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  19. Dim Access_Token = tJson["access_token"]¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  20. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  21. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  22. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  23. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  24. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  25. sUrl = "https://aip.baidubce.com/rest/2.0/ocr/v1/general_basic" & "?access_token=" & Access_Token¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  26. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  27. // 需要先将图片转成base64编码¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  28. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  29. Dim ImgBase64 = ShanHai.ReadFileBase(GetSdcardDir() & "/Pictures/test.png")¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  30. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  31. // 对内容进行url编码¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  32. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  33. ImgBase64 = ShanHai.CharToUrl(ImgBase64)¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  34. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  35. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  36. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  37. sJson = SHTTP.Post(sUrl, {"image":ImgBase64},{"headers":{"Content-Type":"application/x-www-form-urlencoded"}})¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  38. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  39. tJson = Cjson.Decode(sJson)¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  40. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  41. For i = 1 To Len(tJson["words_result"])¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  42. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  43. TracePrint tJson["words_result"][i]["words"]¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  44. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  45. Next¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
  46. ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,u꾕´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê ¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
复制代码
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
插件开源下载(回复可见):¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
[attach]251160[/attach]¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê
¾•´:^GBÊbbs.vrbrothers.comD®AÄÒt,uê

发新话题 回复该主题