Visual Basic

This article provides an example of using a proxy to make an HTTP request with the Visual Basic programming language.

Visual Basic Code

In this example, we use the Residential proxy below:
This proxy is split into four parts separated by colons. We first save the proxy as a string variable, then split it into four parts at each colon (:) and then add it, with authentication, to our proxy dictionary.
Imports System.IO
Imports System.Net
Module Module1
Private Const proxy_string = ""
Private proxy_parts As String() = proxy_string.Split(":"c)
Private ip_address As String = proxy_parts(0)
Private port As String = proxy_parts(1)
Private username As String = proxy_parts(2)
Private password As String = proxy_parts(3)
Private Const url As String = ""
Sub Main()
Dim httpWebRequest = CType(WebRequest.Create(url), HttpWebRequest)
Dim webProxy = New WebProxy(New Uri("http://" & ip_address & ":" & port)) With {
.Credentials = New NetworkCredential(username, password)
httpWebRequest.Proxy = webProxy
Dim httpWebResponse = CType(httpWebRequest.GetResponse(), HttpWebResponse)
End Sub
End Module
Last modified 1yr ago