Public Function getProxyL(ByVal num As Integer, ByVal classid As Integer) As String
Dim rs As String = ""
Dim Expires_in As Integer = 0 '过期时间
Dim url As String = "http://域名/api/default?mid=20&num=" & num & "&classid=" & classid
Try
Dim objHTTP As Object = System.Web.HttpContext.Current.Server.CreateObject("Msxml2.ServerXMLHTTP")
objHTTP.open("GET", url, False)
objHTTP.send()
Dim r As String = objHTTP.responseText
objHTTP = Nothing
rs = r
Catch ex As Exception
Throw ex
End Try
Return rs
End Function
调用:
Dim Jsonstr As String = getProxyL(8, 27)
Dim r As ArrayList = CType(JsonConvert.DeserializeObject(Jsonstr, GetType(ArrayList)), ArrayList)
If r.Count > 0 Then
rpt_news.DataSource = r
rpt_news.DataBind()
End If