-- 回复:(有点蓝)汗,第一次用这玩意,居然不能强类型...
下面是实现操作的代码:
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
假设现在已经创建了一张“数据存放表”【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】