// Входные данные
$url = "https://data.tronk.info/reportrequest.ashx";
$request_params = array(
"key" => "867983b5-d66d-44d7-b440-5bd00b0b8203",
"mode" => "setqueue",
"gosnumber" => "А111АА11"
);
$get_params = http_build_query($request_params);
// Запрос к серверу
$response = file_get_contents($url."?".$get_params);
// Преобразование ответа
$result = json_decode($response);
import requests
url = "https://data.tronk.info/reportrequest.ashx"
# входные данные
params = {
"key": "867983b5-d66d-44d7-b440-5bd00b0b8203",
"mode": "setqueue",
"gosnumber": "А111АА11",
}
# отправка запроса
response = requests.post(
url=url,
params=params,
)
# преобразование ответа к словарю
data = response.json()
using Newtonsoft.Json;
class Program
{
static async Task Main(string[] args)
{
string end_point = "https://data.tronk.info/reportrequest.ashx";
Dictionary< string, string > dict_params = new()
{
{ "key", "867983b5-d66d-44d7-b440-5bd00b0b8203" },
{ "mode", "setqueue" },
{ "gosnumber", "А111АА11" },
};
string url_params = string.Join("&", dict_params.Select(kvp => $"{kvp.Key}={kvp.Value}"));
string url = $"{end_point}?{url_params}";
HttpClient client = new();
string response_body = await client.GetAsync(url).Result.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject(response_body);
}
}
// Входные данные
$url = "https://data.tronk.info/reportrequest.ashx";
$request_data = array(
"key" => "867983b5-d66d-44d7-b440-5bd00b0b8203",
"mode" => "setqueue",
"gosnumber" => "А111АА11",
"customreport" => "1",
"custom_headerlogo" => "https://mydomain/img/logo/logo.svg",
"custom_companyurl" => "https://mydomain",
"custom_socialicons" => array(
array(
"icon" => "https://mydomain/I/vk.png",
"url" => "http://vk.com/vk"
),
array(
"icon" => "https://mydomain/I/telegram.png",
"url" => "https://t.me/tg"
),
array(
"icon" => "https://mydomain/I/youtube-play2.png",
"url" => "https://www.youtube.com/channel/"
)
),
"custom_headerhtml" => "TRONK",
"custom_companyphones" => "8-800-000-0000",
"custom_companyemalis" => "my@email.com",
"custom_companyschedule" => "11:00 - 20:00 МСК",
"custom_companytagtext" => array(
"tagline" => "Здесь будет слоган",
"sitename" => "TRONK"
),
"custom_companyappstore" => "http://appstore_url",
"custom_companygoogleplay" => "http://playmarket_url"
);
// Создание JSON строки из данных
$json_data = json_encode($request_data);
// Параметры контекста для HTTP запроса
$request_params = array(
"http" => array(
"method" => "POST",
"header" => "Content-type: application/json\r\n",
"content" => $json_data
)
);
$context = stream_context_create($request_params);
// Запрос к серверу
$response = file_get_contents($url, false, $context);
// Преобразование ответа
$result = json_decode($response);
if ($result === null) {
// Обработка ошибки в случае некорректного ответа
echo "Ошибка декодирования JSON: ", json_last_error_msg();
} else {
// Вывод результата
print_r($result);
}
import requests
url = "https://data.tronk.info/reportrequest.ashx"
# Входные данные
params = {
"key": "867983b5-d66d-44d7-b440-5bd00b0b8203",
"mode": "setqueue",
"gosnumber": "А111АА11",
"customreport": "1",
"custom_headerlogo": "https://mydomain/img/logo/logo.svg",
"custom_companyurl": "https://mydomain",
}
json_data = {
"custom_socialicons": [
{
"icon": "https://mydomain/I/vk.png",
"url": "http://vk.com/vk"
},
{
"icon": "https://mydomain/I/telegram.png",
"url": "https://t.me/tg"
},
{
"icon": "https://mydomain/I/youtube-play2.png",
"url": "https://www.youtube.com/channel/"
}
],
"custom_headerhtml": "TRONK",
"custom_companyphones": "8-800-000-0000",
"custom_companyemalis": "my@email.com",
"custom_companyschedule": "11:00 - 20:00 МСК",
"custom_companytagtext": {
"tagline": "Здесь будет слоган",
"sitename": "TRONK"
},
"custom_companyappstore": "http://appstore_url",
"custom_companygoogleplay": "http://playmarket_url"
}
# Отправка запроса
response = requests.post(
url=url,
json=json_data,
params=params,
headers={"Content-Type": "application/json"}
)
# Преобразование ответа к словарю
try:
data = response.json()
except ValueError:
print("Ошибка при декодировании JSON из ответа:", response.text)
else:
print(data)
using Newtonsoft.Json;
class Program
{
static void Main()
{
string end_point = "https://data.tronk.info/reportrequest.ashx";
Dictionary< string, string > dict_params = new()
{
{ "key", "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" },
{ "mode", "setqueue" },
{ "gosnumber", "X000XX000" },
{ "customreport", "1" },
{ "custom_headerlogo", "https://mydomain/img/logo/logo.svg" },
{ "custom_companyurl", "https://mydomain" }
};
string url_params = string.Join("&", dict_params.Select(kvp => $"{kvp.Key}={kvp.Value}"));
string url = $"{end_point}?{url_params}";
// Создание объекта с данными для отправки в формате JSON
var postData = new
{
custom_socialicons = new[]
{
new { icon = "https://mydomain/I/vk.png", url = "http://vk.com/vk" },
new { icon = "https://mydomain/I/telegram.png", url = "https://t.me/tg" },
new { icon = "https://mydomain/I/youtube-play2.png", url = "https://www.youtube.com/channel/" }
},
custom_headerhtml = "TRONK",
custom_companyphones = "8-800-000-0000",
custom_companyemalis = "my@email.com",
custom_companyschedule = "11:00 - 20:00 МСК",
custom_companytagtext = new
{
tagline = "Здесь будет слоган",
sitename = "TRONK"
},
custom_companyappstore = "http://appstore_url",
custom_companygoogleplay = "http://playmarket_url"
};
// Сериализация данных в JSON-строку
string jsonData = JsonConvert.SerializeObject(postData);
// Создание и отправка запроса
using HttpClient client = new();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri(url),
Headers =
{
{ "Accept", "application/json" },
{ "Connection", "keep-alive" }
},
Content = new StringContent(jsonData)
{
Headers =
{
ContentType = new MediaTypeHeaderValue("application/json")
}
}
};
string response_body = "";
using (var response = client.SendAsync(request).Result)
{
response_body = response.Content.ReadAsStringAsync().Result;
}
// Десериализация ответа
var result = JsonConvert.DeserializeObject(response_body);
Console.WriteLine(result);
}
}
// Входные данные
$url = "https://data.tronk.info/reportrequest.ashx";
$request_params = array(
"key" => "867983b5-d66d-44d7-b440-5bd00b0b8203",
"mode" => "checkqueue",
"id" => 123
);
$get_params = http_build_query($request_params);
// Запрос к серверу
$response = file_get_contents($url."?".$get_params);
// Преобразование ответа
$result = json_decode($response);
import requests
url = "https://data.tronk.info/reportrequest.ashx"
# входные данные
params = {
"key": "867983b5-d66d-44d7-b440-5bd00b0b8203",
"mode": "checkqueue",
"id": 123,
}
# отправка запроса
response = requests.post(
url=url,
params=params,
)
# преобразование ответа к словарю
data = response.json()
using Newtonsoft.Json;
class Program
{
static async Task Main(string[] args)
{
string end_point = "https://data.tronk.info/reportrequest.ashx";
Dictionary< string, string > dict_params = new()
{
{ "key", "867983b5-d66d-44d7-b440-5bd00b0b8203" },
{ "mode", "checkqueue" },
{ "id", 123 },
};
string url_params = string.Join("&", dict_params.Select(kvp => $"{kvp.Key}={kvp.Value}"));
string url = $"{end_point}?{url_params}";
HttpClient client = new();
string response_body = await client.GetAsync(url).Result.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject(response_body);
}
}
// Входные данные
$url = "https://data.tronk.info/reportrequest.ashx";
$request_params = array(
"key" => "867983b5-d66d-44d7-b440-5bd00b0b8203",
"mode" => "getresult",
"id" => 123
);
$get_params = http_build_query($request_params);
// Запрос к серверу
$response = file_get_contents($url."?".$get_params);
// Преобразование ответа
$result = json_decode($response);
import requests
url = "https://data.tronk.info/reportrequest.ashx"
# входные данные
params = {
"key": "867983b5-d66d-44d7-b440-5bd00b0b8203",
"mode": "getresult",
"id": 123,
}
# отправка запроса
response = requests.post(
url=url,
params=params,
)
# преобразование ответа к словарю
data = response.json()
using Newtonsoft.Json;
class Program
{
static async Task Main(string[] args)
{
string end_point = "https://data.tronk.info/reportrequest.ashx";
Dictionary< string, string > dict_params = new()
{
{ "key", "867983b5-d66d-44d7-b440-5bd00b0b8203" },
{ "mode", "getresult" },
{ "id", 123 },
};
string url_params = string.Join("&", dict_params.Select(kvp => $"{kvp.Key}={kvp.Value}"));
string url = $"{end_point}?{url_params}";
HttpClient client = new();
string response_body = await client.GetAsync(url).Result.Content.ReadAsStringAsync();
var result = JsonConvert.DeserializeObject(response_body);
}
}