以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [求助]jsonp返回值提取数据 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=177440) |
-- 作者:洮沙 -- 发布时间:2022/5/22 17:41:00 -- [求助]jsonp返回值提取数据 老师,有以下接口代码: Dim hc As New HttpClient("https://api.ip138.com/ip/?ip=36.142.141.5&datatype=jsonp&token=8cf1fa2630193321346d5260d2") ’token信息不真实 Dim ret As String = hc.getData() Output.Show(ret) Dim jo As JObject = JObject.Parse(ret) Output.Show(jo("ret")) Output.Show(jo("ip")) Output.Show(jo("data")) 执行显示如下错误信息: 麻烦问一下老师,如何才能获取到: 中国\\甘肃\\定西\\\\移动\\743000\\0932 帮忙指点一下,谢谢! [此贴子已经被作者于2022/5/22 17:44:43编辑过]
|
-- 作者:有点蓝 -- 发布时间:2022/5/22 20:38:00 -- 参考:http://www.foxtable.com/mobilehelp/topics/0140.htm,看示例四 Dim ja As JArray = jo("data")
For i As Integer = 0 To ja.Count - 1 Output.Show(ja(i).ToString) Next |
-- 作者:洮沙 -- 发布时间:2022/5/22 21:04:00 -- 代码如下,完美解决,谢谢老师! Dim ip2 As String = "36.142.141.5" Dim hc As New HttpClient("https://api.ip138.com/ip/?ip="& ip2 &"&datatype=jsonp&token=8cf1fa2630193321346d5260d2") Dim ret As String = hc.getData() Dim jo As JObject = JObject.Parse(ret) Dim ja As JArray = jo("data") Dim z As String For i As Integer = 0 To ja.Count - 1 z = z & ja(i).ToString & "\\" Next Output.Show(z) [此贴子已经被作者于2022/5/22 21:04:37编辑过]
|