I'm trying to get the html code of a website via some proxy server so that I can hide my IP address and increase response speed when doing several webrequests. However my code is not working and keeps giving errors like:
"The remote server returned an error: (500) Internal Server Error."
"Cannot send a content-body with this verb-type."
Any help would be very much appreciated. Here my code:
Dim sData As System.Text.StringBuilder = New System.Text.StringBuilder()
Dim bData() As Byte = system.Text.UTF8Encoding.UTF8.GetBytes(sData.ToString())
Dim myProxy As New WebProxy("184.108.40.206:80", True)
Dim myWebRequest As WebRequest
Dim myWebResponse As WebResponse
myWebRequest = CType(WebRequest.Create(url), WebRequest)
myWebRequest.Proxy = myProxy
myWebRequest.UseDefaultCredentials = True
myWebRequest.Method = "POST"
myWebRequest.ContentType = "text/xml"
myWebRequest.ContentLength = bData.Length
myWebRequest.Timeout = 5000
myWebResponse = CType(myWebRequest.GetResponse(), WebResponse)
Dim postStream As System.IO.Stream = myWebRequest.GetRequestStream()
postStream.Write(bData, 0, bData.Length)
htmlStream = New System.IO.StreamReader(myWebResponse.GetResponseStream())
Thank you very much !