Ребят подскажите как на шарпе проксить сайт например возмем сайт авито(я против работы по ру) просто как пример. Какими лучше библиотеками пользоваться как подменять различные данные на этом реверс прокси ?
using System.Net;
namespace HttpClientProxy
{
class Program
{
static async Task Main(string[] args)
{
string proxyURL = "http://proxy_server:8080";
WebProxy webProxy = new WebProxy(proxyURL);
HttpClientHandler httpClientHandler = new HttpClientHandler
{
Proxy = webProxy
};
HttpClient client = new HttpClient(httpClientHandler);
try
{
using HttpResponseMessage response = await client.GetAsync("https://ipinfo.io/ip");
string responseContent = await response.Content.ReadAsStringAsync();
Console.WriteLine(responseContent);
}
catch (HttpRequestException e)
{
Console.WriteLine("Request failed with error: ", e.Message);
}
}
}
}
I'm not accusing you of anything so don't fire right away but c#, java's bureaucratic API with its function, data struct names seem like something out of an LLM's mouth lol.Можно юзать дефолтный HttpClientProxy
C#:using System.Net; namespace HttpClientProxy { class Program { static async Task Main(string[] args) { string proxyURL = "http://proxy_server:8080"; WebProxy webProxy = new WebProxy(proxyURL); HttpClientHandler httpClientHandler = new HttpClientHandler { Proxy = webProxy }; HttpClient client = new HttpClient(httpClientHandler); try { using HttpResponseMessage response = await client.GetAsync("https://ipinfo.io/ip"); string responseContent = await response.Content.ReadAsStringAsync(); Console.WriteLine(responseContent); } catch (HttpRequestException e) { Console.WriteLine("Request failed with error: ", e.Message); } } } }