我試圖使用公共代理服務器(http://www.unblockwebnow.info/)發送HTTP請求到目標站點使用公共代理服務器,說http://stackoverflow.com :)在HTTP客戶端
我的HTTP客戶端以下結構:
string url = "http://stackoverflow.com";
HttpWebRequest HttpWRequest = (HttpWebRequest)WebRequest.Create(url);
HttpWRequest.Method = "GET";
WebProxy myProxy = new WebProxy();
myProxy.Address = new Uri("http://www.unblockwebnow.info/");
HttpWRequest.Proxy = myProxy;
HttpWebResponse HttpWResponse = (HttpWebResponse)HttpWRequest.GetResponse();
StreamReader sr = new StreamReader(HttpWResponse.GetResponseStream(), encoding);
var rawHTML = sr.ReadToEnd();
sr.Close();
執行代碼rawHTML後,我得到"pageok -managed by puppet - hostingcms02 pageok"
如果我註釋掉HttpWRequest.Proxy = myProxy;
線,我得到了網站內容。
代理地址是各種混亂的。看起來像一個垃圾網站。 –
嘗試另一個代理 –
和端口以及 – VladL