سؤال

وأريد أن تطوير برنامج يستخدم API على الانترنت، مع طلبات GET و POST، وأريد أن أعرف كيفية جعل الطلبات ضمن برنامج (بدون المستعمل رؤية صفحة على شبكة الإنترنت)، ومن ثم تحميل النتائج إلى البرنامج حتى أتمكن من تحليل لهم

هل كانت مفيدة؟

المحلول

أنت تبحث عن 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()
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top