Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Пример запроса.
- */
- require_once $_SERVER['DOCUMENT_ROOT'].'/kint.php';
- function apiRequest($token, $data)
- {
- header('Content-Type: application/json');
- $ch = curl_init('http://tau.mdm-complect.ru/api/');
- // $headers[] = "Content-Type: application/json";
- // $headers[] = "Accept: application/json";
- $headers[] = "Authorization: Bearer $token";
- // $headers[] = "Accept-Language: en";
- curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_POST, 1);
- curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
- $result = curl_exec($ch);
- curl_close($ch);
- return $result;
- }
- $token = '111ea2450228a5d655e3a8c2f9a5aedc30b591df';
- $data = [
- 'type' => 'get',
- 'form_id' => 2,
- 'limit' => 3,
- // 'from' => '02.04.2021',
- // 'to' => '02.04.2021',
- ];
- $request = apiRequest($token, $data); // Send or retrieve data
- echo $request;
- die;
Add Comment
Please, Sign In to add comment