以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  获取https链接看返回的json内容  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=183979)

--  作者:fntfgz
--  发布时间:2022/11/21 20:56:00
--  获取https链接看返回的json内容
老师,我想获取下面网址的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编辑过]

--  作者:有点蓝
--  发布时间: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)