Dim postdata As String ="{""type"":""news"",""offset"":""0"",""count"":""10""}"
Dim url = String.Format("https://api.weixin.qq.com/cgi-bin/material/batchget_material?access_token=QabsAuaz9o85YgwM147Gt1_ZnHDTY09wkD0a8pyuC9-okZeXfmUfLd3S6HuW4-CTqh-8rml1-MtLUgFASDMZtPzbmrmWGxyUuj6ff12qcRN7jFe6X8avrPs0y_t5AImeHIYfAFAWXN")
Using ms As New System.IO.MemoryStream()
Dim bytes = ConvertHelper.EncodingToBytes(postdata, System.Text.Encoding.UTF8)
ms.Write(bytes, 0, bytes.Length)
ms.Seek(0, System.IO.SeekOrigin.Begin)
Dim json As String = Functions.Execute("HttpPost",url, ms)
Dim ScriptControl As Object, data As Object, JscriptCode As String
JscriptCode = "function toObject(json) {eval(""var o=""+json);return o;}"
ScriptControl = CreateObject("MSScriptControl.ScriptControl")
With ScriptControl
.Language = "Javascript"
.Timeout = -1
.AddCode(JscriptCode)
data = .Run("toObject", json)
End With
For Each obj As object In data.item
Output.Show(obj.media_id)
Output.Show(obj.update_time)
For Each item As object In obj.content.news_item
Output.Show(item.title)
Next
For Each item As object In obj.content.news_item
Output.Show(item.url)
Next
For Each item As object In obj.content.news_item
Output.Show(item.author)
Next
Next
End Using
运行上面的代码 得到下面的值:
(黑色部分加粗是标注说明的,json生成的时候并无)
【media_id】gwmL5Qi-95lfkB7dnSYm66KXipsv1QpQgoy7exD5HFY
【update_time】1476065493
【title】
【1】新买的手机号发现绑定支付宝!竟能从对方账户转钱,速看??
【2】国庆节大事纪:19城市调控楼市、金价大暴跌
【3】2016南方电网云南国际有限责任公司招聘公告
【4】以后这三种人,不要去打扰他
【5】我不优秀,但我善良不虚伪
【url】
【1】http://mp.weixin.qq.com/s?__biz=MzAxMzAzNjg0Mw==&mid=503499675&idx=1&sn=ce1c640d5c575b834119199f23fd6f54&chksm=005ed7df37295ec96eb7cc15cc7725cc90214bca813e0ac6f11a67b2151b70d69517be19d6fc#rd
【2】http://mp.weixin.qq.com/s?__biz=MzAxMzAzNjg0Mw==&mid=503499675&idx=2&sn=8c9b36dc892f017023a5eca7ba2cacfd&chksm=005ed7df37295ec99cddd95b02b2f75bb305dce1b8a4fcc770e6ce5c018832bf2c1566a9c8c0#rd
【3】http://mp.weixin.qq.com/s?__biz=MzAxMzAzNjg0Mw==&mid=503499675&idx=3&sn=b2cbb0da8becf16ee0bf450173d2bab2&chksm=005ed7df37295ec956ba13865cf683321d0b8de92877b5082ea3d85f8b934d948e8dc292b472#rd
【4】http://mp.weixin.qq.com/s?__biz=MzAxMzAzNjg0Mw==&mid=503499675&idx=4&sn=a00623b8848284412a2d283c670f12ba&chksm=005ed7df37295ec998aca34867c4637799b12e314dc8550941687bdf5a8d70ccfe23f2465a53#rd
【5】http://mp.weixin.qq.com/s?__biz=MzAxMzAzNjg0Mw==&mid=503499675&idx=5&sn=3fd4f724d1ff668f226bfe1c0ff51c10&chksm=005ed7df37295ec997fdf0724af44d752d1eeb73177cd8ee6247fc1092365b2659026dee6ec0#rd
【media_id】gwmL5Qi-95lfkB7dnSYm68rJVtcRTKnjQAQGM24ebSk
【update_time】1475199000
【title】
【1】继微信后支付宝也将提现收费:每人2万基础免费额度,余额宝转出依然免费
【2】有人算过一笔账,得出一惊人结论:中国人根本就不用买房!
【3】一生都学不完的计谋,没心眼的看看吧!
【4】国庆放假通知
【url】
【1】http://mp.weixin.qq.com/s?__biz=MzAxMzAzNjg0Mw==&mid=503499675&idx=1&sn=ce1c640d5c575b834119199f23fd6f54&chksm=005ed7df37295ec96eb7cc15cc7725cc90214bca813e0ac6f11a67b2151b70d69517be19d6fc#rd
【2】http://mp.weixin.qq.com/s?__biz=MzAxMzAzNjg0Mw==&mid=503499675&idx=2&sn=8c9b36dc892f017023a5eca7ba2cacfd&chksm=005ed7df37295ec99cddd95b02b2f75bb305dce1b8a4fcc770e6ce5c018832bf2c1566a9c8c0#rd
【3】http://mp.weixin.qq.com/s?__biz=MzAxMzAzNjg0Mw==&mid=503499675&idx=3&sn=b2cbb0da8becf16ee0bf450173d2bab2&chksm=005ed7df37295ec956ba13865cf683321d0b8de92877b5082ea3d85f8b934d948e8dc292b472#rd
【4】http://mp.weixin.qq.com/s?__biz=MzAxMzAzNjg0Mw==&mid=503499675&idx=4&sn=a00623b8848284412a2d283c670f12ba&chksm=005ed7df37295ec998aca34867c4637799b12e314dc8550941687bdf5a8d70ccfe23f2465a53#rd
…………………………下面还有很多 省略
假设现在已经创建了一张“数据存放表”【media_id】【update_time】【title】【url】四个字段
怎么将【media_id】【update_time】【title】【url】对应的【1】【2】【3】【4】【5】分别一一对应起来呢?
【media_id】【update_time】【1】【1】
【media_id】【update_time】【2】【2】
【media_id】【update_time】【3】【3】
【media_id】【update_time】【4】【4】
【media_id】【update_time】【5】【5】
[此贴子已经被作者于2016/10/12 20:10:00编辑过]