2009-03-18 3 views
2

GET 및 POST 요청과 함께 온라인 API를 사용하는 프로그램을 개발하고 사용자없이 프로그램 내에서 요청을 만드는 방법을 알고 싶습니다. 웹 페이지보기)를 다운로드 한 다음 결과를 프로그램으로 다운로드하여 구문 분석 할 수 있습니다.VB.net에서 GET/POST 요청의 결과로드

답변

3

WebRequest 클래스를 찾고 있습니다. 이 예제는 msdn 설명서에서 수정되었습니다.

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() 
+0

K 또한 데이터를 반환하는 POST 요청은 어떻습니까? –

+1

http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.method.aspx –