tags:

views:

1886

answers:

1

I want to develop a program that uses an online API, with GET and POST requests, and I want to know how to make the requests within the program (without the user seeing a web page), and then download the results into the program so I can parse them

+3  A: 

You're looking for the WebRequest class. This example has been adapted from the msdn documentation:

Dim request As WebRequest = WebRequest.Create("http://www.example.com/example.html")
' Get the response.
Dim response As HttpWebResponse = CType(request.GetResponse(), HttpWebResponse)
' 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()
Ken Browning
K, how about for POST requests that also return data?
Luke
http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.method.aspx
Ken Browning