微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

API非常慢

如何解决API非常慢

我需要从其他网站获取一些详细信息,他们正在提供API。您能帮我建立更快的连接并做出反应吗?我的代码是:

Try
    Dim addr As String
    addr = tb_input.Text

    ' Create a request for the URL. 
    Dim request As WebRequest = WebRequest.Create(addr)
    ' If required by the server,set the credentials.
    request.Credentials = CredentialCache.DefaultCredentials

    ' Get the response.
    Dim response As WebResponse = request.GetResponse()

    ' display the status.
    ' Get the stream containing content returned by the server.
    Dim dataStream As Stream = response.GetResponseStream()

    ' Open the stream using a StreamReader for easy access.
    Dim reader As New StreamReader(dataStream)

    ' Read the content.
    Dim responseFromServer As String = reader.ReadToEnd()

    ' display the content.
    tb_result.Text = responseFromServer

    ' Clean up the streams and the response.
    reader.Close()
    response.Close()
Catch ex As Exception
    MsgBox(ex.InnerException)
End Try

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。