如何在Vb net中使用API

时间:2016-03-14 05:37:22

标签: vb.net

在VB.net中发布http get的最佳方法是什么?我想得到像

这样的请求的结果

http://89.36.220.56/api.php?photo=urlphoto&point=numberlikes&socks=proxy

  • Photo =网址照片
  • Point = Number
  • 袜子=代理

1 个答案:

答案 0 :(得分:-1)

    Dim url = "http://89.36.220.56/api.php?photo=urlphoto&point=numberlikes&socks=proxy"
    Dim request = DirectCast(WebRequest.Create(url), HttpWebRequest)
    Dim response = request.GetResponse()
    Dim receiveStream As Stream = response.GetResponseStream()
    Dim readStream As New StreamReader(receiveStream, Encoding.UTF8)
    Dim data = readStream.ReadToEnd()
    response.Close()
    readStream.Close()