K
K
Kirill Legend2020-02-09 16:27:37
C++ / C#
Kirill Legend, 2020-02-09 16:27:37

C# how to create an http request and get variables from it?

C# how to create an http request and get variables from it? (I do it in the browser, see screenshot). And you need the same in the program. I also need to display the request values ​​in variables such as key, server, ts
3RCjGHbubPs.jpg

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2020-02-09
@NeiroNx

Uri address = new Uri("https://api.vk.com/blablabla");
ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | (SecurityProtocolType)(0xc0 | 0x300 | 0xc00);
WebClient client = new WebClient();
client.Encoding = System.Text.Encoding.UTF8;
String request = client.DownloadString(address);
client.Dispose();
YourObject myobject = JsonParser.deserialize(request);//так как C# не имеет встроенных методов разборки JSON то тут вызрв библиотечной функции.

F
fan92rus, 2020-02-12
@fan92rus

First, open the fox, check the box for continuous logs. Use RestSharp or Xnet. since you will need cookies to reproduce a series of requests leading to this result. for parsing, you can use Newtonsoft.Json

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question