Foxtable(狐表)用户栏目专家坐堂 → 获取https链接看返回的json内容


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

主题:获取https链接看返回的json内容

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


加好友 发短信
等级:一尾狐 帖子:424 积分:5115 威望:0 精华:0 注册:2012/11/16 8:21:00
获取https链接看返回的json内容  发帖心情 Post By:2022/11/21 20:56:00 [只看该作者]

老师,我想获取下面网址的json,
https://www.kkdaxue.com/api/post/list/page?current=1&pageSize=10&reviewStatus=1&sortField=createTime&sortOrder=descend

之前都用下面的代码,但是这个链接是https,提示错误,请老师给个思路,谢谢老师

Dim url As String = "https://www.kkdaxue.com/api/post/list/page?current=1&pageSize=10&reviewStatus=1&sortField=createTime&sortOrder=descend"
Dim rqst As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(url)
Dim rsps As System.Net.HttpWebResponse = rqst.GetResponse
Dim stm As System.IO.Stream = rsps.GetResponseStream()
Dim reader As New System.IO.StreamReader(stm)
Dim json As String = reader.ReadToEnd
rsps.Close
stm.Close
reader.close
output.show(json)




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

[此贴子已经被作者于2022/11/21 20:56:24编辑过]

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


加好友 发短信
等级:超级版主 帖子:110592 积分:562856 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2022/11/21 21:35:00 [只看该作者]

Net.ServicePointManager.SecurityProtocol = Net.SecurityProtocolType.Tls11
Dim hc As New HttpClient("https://www.kkdaxue.com/api/post/list/page?current=1&pageSize=10&reviewStatus=1&sortField=createTime&sortOrder=descend")
Dim ret As String = hc.GetData()
Output.Show(ret)

 回到顶部