K
K
kolya1122020-11-23 16:41:18
API
kolya112, 2020-11-23 16:41:18

How to send a request to the website API?

I have a C# Windows forms, 4.6 .Net framework project. I need to get variables from the site's API to put a value in a textbox.
// Performing JS requests to the required API.
// Connection
For example, if the URL looks like servers-samp.ru/server-6 , then its ServerID = 6.

<script src="http://servers-samp.ru/api/174106"></script> // 174106 мой ID

// The required code itself, here 2 values ​​come as a response - the current online and the maximum (total slots on the server) possible on the server. These values ​​must be entered into a variable and actually passed to the form.
<script>document.write(info.players);</script> / <script>document.write(info.maxplayers);

A big request to help.
Thank you all in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Shamanov, 2020-11-23
@kolya112

using System.Net.Http.HttpClient

E
eRKa, 2020-11-23
@kttotto

https://docs.microsoft.com/en-us/dotnet/api/system...
or
https://restsharp.dev/getting-started/getting-star...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question