Get data from web using proxy
Hy,
I need to get data from IMDB using proxy. I made program which can download data, but the were downloaded on Croatian language because I'm from Croatia so I need to use UK proxy to get that data in English!
Code:
Dim url As String = "http://www.imdb.com/search/title?sort=moviemeter,asc&start=" & j & "&title_type=feature&year=2010,2010"
Dim html, naslov, ocjena As String
Dim request As Net.HttpWebRequest = Net.HttpWebRequest.Create(url)
Dim response As Net.HttpWebResponse
response = request.GetResponse
Using sr As New IO.StreamReader(response.GetResponseStream)
html = sr.ReadToEnd()
End Using
request.Abort()
response.Close()
How to use proxy in this code? I really need help with this...
Thanks in advance, dapapo
Re: Get data from web using proxy
do you have a proxy list
if so try this
Code:
Dim IP As String = String.Empty
Dim index As New Random
Dim num As Integer = 0
proxylist = New ArrayList
Dim url As String = "http://www.imdb.com/search/title?sort=moviemeter,asc&start=" & j & "&title_type=feature&year=2010,2010"
Dim html, naslov, ocjena As String
Dim request As Net.HttpWebRequest = Net.HttpWebRequest.Create(url)
Dim oldproxy As IWebProxy = CType(request.Proxy, IWebProxy)
num = index.Next(0, proxylist.Count)
IP = proxylist.Item(num)
Dim Port As String = "80"
Dim proxy As New WebProxy() '& ":" & Port, True
Dim newuri As New Uri("http://" & IP)
proxy.Address = newuri
request.Proxy = proxy
Re: Get data from web using proxy
Where to add proxy list?
And how to make if I only wnat to use one proxy?
p.s. in which format proxy must be in the list?
Re: Get data from web using proxy