I have used Postman for a while, its user interface looks good. But now, I need to go one step further. I want to visit one web page: https://www.betonline.ag/sportsbook/soccer/todaygames
From my testing, I think this web page has some settings to prevent bot to visit, so I have to add at least the following headers: Accept, Accept-Language, Connection and User-Agent.
However, at first run, the HTTP Get request failed, I got 302 forbidden by cloudflare server.
But after I change cookies settings, then Postman can accept the cookies by cloudflare server, I can use HTTP Get to see the web page contents.
Since I need to use C# code to visit this page every day, I need a reusable C# code, but the following C# RestSharp code generated by Postman is definitely not reusable:
var client = new RestClient(“https://www.betonline.ag/sportsbook/soccer/todaygames”);
client.Timeout = -1;
var request = new RestRequest(Method.GET);
client.UserAgent = “Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko; Google Page Speed Insights) Chrome/27.0.1453 Safari/537.36”;
request.AddHeader(“Cookie”, “__cfduid=d0b759ddd2fd299d2f2c9de03c4b0fc831593630928; ASP.NET_SessionId=zmbl3m55wabw5xzhpwg2hoii; KW_Search=domain=&kw=&HTTP_Refer=; UDeepLink=soccer/todaygames; THE_COOKIE=!ef7wV0H9Y9t2yIxPZwurU0T9hxdEzJFAztB+RpjU4Uz8zPZlOuVGRJLwhs0xfqY4iW2I0Y//6upBQL0=; __cf_bm=f377f88979eb854414f241a9d4a4278d7b21b57d-1593630929-1800-AcjtwRqjj28AHCeQxzs2XKTQv4ylFCKQxDbO8j63ozFZB20Qn8M/HURpnvtpQHCeUZHEEWCbbd6q86ikys3FDWg=; __cfruid=4fe1f54b6a72e832bfd73e54a7f789635e6302e7-1593630929”);
IRestResponse response = client.Execute(request);
I want to know how to get the cookies set by cloudflare and reuse C# code, so I can visit the web page as long as I wish.