BetterHttpClient.ProxyManager.PostPage C# (CSharp) Метод

PostPage() публичный Метод

Downloads url using POST.
Page has returned 404 not found
public PostPage ( string url, NameValueCollection data, string requiredString = null, CookieContainer cookies = null, NameValueCollection customHeaders = null ) : string
url string Url of webpage
data System.Collections.Specialized.NameValueCollection Post values
requiredString string
cookies System.Net.CookieContainer Cookies for request. Left null if you don't want to use cookies
customHeaders System.Collections.Specialized.NameValueCollection Specify custom headers for this request
Результат string
        public string PostPage(string url, NameValueCollection data, string requiredString = null, CookieContainer cookies = null, NameValueCollection customHeaders = null)
        {
            if (requiredString == null)
                requiredString = RequiredString;

            string page = null;
            int limit = 0;

            do
            {
                Proxy proxy = GetAvalibleProxy();
                
                try
                {
                    if (AnonymousProxyOnly)
                    {
                        if (AnonymousProxyOnly && !proxy.IsAnonymous(ProxyJudgeService))
                        {
                            continue;
                        }
                    }

                    var bytes = DownloadBytes(url, data, proxy, cookies, customHeaders);

                    if (bytes != null)
                    {
                        page = Encoding.GetString(bytes);
                        if (!page.Contains(requiredString))
                        {
                            proxy.IsOnline = false;
                        }
                        else
                        {
                            return page;
                        }
                    }
                }
                finally
                {
                    limit++;
                    proxy.IsBusy = false;
                }

                limit++;
            } while (limit < _numberOfAttemptsPerRequest);

            throw new AllProxiesBannedException();
        }