BetterHttpClientCore 1.0.7.3
dotnet add package BetterHttpClientCore --version 1.0.7.3
NuGet\Install-Package BetterHttpClientCore -Version 1.0.7.3
<PackageReference Include="BetterHttpClientCore" Version="1.0.7.3" />
paket add BetterHttpClientCore --version 1.0.7.3
#r "nuget: BetterHttpClientCore, 1.0.7.3"
// Install BetterHttpClientCore as a Cake Addin
#addin nuget:?package=BetterHttpClientCore&version=1.0.7.3
// Install BetterHttpClientCore as a Cake Tool
#tool nuget:?package=BetterHttpClientCore&version=1.0.7.3
BetterHttpClient
BetterHttpClient will help you making http and https requests with full cookie support.
It supports three types of proxy servers:
- HTTP
- HTTPS
- Socks5
Http Client
- Http GET request
HttpClient client = new HttpClient
{
UserAgent = "My custom user-agent",
Referer = "My referer",
Encoding = Encoding.UTF8,
AcceptEncoding = "gzip, deflate" // setup transfer compression algorithm
};
string page = client.Get("http://www.google.com");
- Http POST request
HttpClient client = new HttpClient(); // if no headers are specified defaults will be used
string page = client.Post("https://httpbin.org/post", new NameValueCollection
{
{"custname", "Some post data"},
});
- Https GET request using proxy
HttpClient will detect proxy type (http/s, socks5) if you don't provide such info.
string proxyAddress = "218.200.66.196:8080";
HttpClient client = new HttpClient(new Proxy(proxyAddress))
{
UserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0"
};
string page = client.Get("https://httpbin.org/get");
Proxy Manager
This class will help you managing large amount of proxy servers.
You can load proxy list from file and then execute GET or POST requests.
If some proxy will be dead ProxyManager will mark them as offline and won't use in future requests.
To perform http/s request it will use first Not Busy and Online proxy (and check for an anonymity level if anonymousOnly is true).
Set anonymousOnly to true if you want to force ProxyManager to use only proxies that really hide your ip. For more info look at ProxyJudgeService class. Methods
- GetPage
- PostPage
- DownloadBytes
are thread safe.
Example usage:
ProxyManager proxyManager = new ProxyManager("proxy_list.txt", anonymousOnly: true)
{
UserAgent = "Mozilla/5.0 (Windows NT 6.3; WOW64; rv:41.0) Gecko/20100101 Firefox/41.0"
PreserveCookies = false, // if true it will use the same cookies between distinct requests
Timeout = TimeSpan.FromSeconds(10),
NumberOfAttempts = 2 // max number of attempts that can be made per one request
};
// ProxyManager will choose first working proxy and use it to perform GET request
string page = proxyManager.GetPage("http://example.com");
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.7.3 | 624 | 1/9/2020 |