Tôi cố gắng để sử dụng máy chủ proxy công cộng (http://www.unblockwebnow.info/) để gửi yêu cầu HTTP đến trang web đích, nói http://stackoverflow.com :)Sử dụng máy chủ proxy công cộng trong HTTP client
client HTTP của tôi có sau kiến trúc:
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();
sau khi thực hiện các mã cho rawHTML tôi nhận được "pageok -managed by puppet - hostingcms02 pageok"
Nếu tôi nhận xét ra HttpWRequest.Proxy = myProxy;
dòng, tôi nhận được nội dung trang web.
Địa chỉ proxy là tất cả các điều sai lầm. Trông giống như một trang web rác. –
hãy thử một proxy khác –
và cổng cũng – VladL