dsandal

Untitled

Jun 4th, 2018
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1. <?php
  2.  
  3. $curl = curl_init();
  4.  
  5. $post = [
  6.     'name' => 'name',
  7.     'description' => 'description',
  8.     'client_id' => 1,
  9.     'manager_id' => 1,
  10. ];
  11.  
  12. $apiToken = '14266863287c8a4f2bddc9c518721068';
  13.  
  14. curl_setopt_array($curl, array(
  15.     CURLOPT_URL => "https://vtcrm.fru-it.ru/api/tickets",
  16.     CURLOPT_RETURNTRANSFER => true,
  17.     CURLOPT_ENCODING => "",
  18.     CURLOPT_MAXREDIRS => 10,
  19.     CURLOPT_TIMEOUT => 30,
  20.     CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  21.     CURLOPT_CUSTOMREQUEST => "POST",
  22.     CURLOPT_POSTFIELDS => http_build_query($post),
  23.     CURLOPT_HTTPHEADER => array(
  24.         "Cache-Control: no-cache",
  25.         "Postman-Token: 70d16a4c-ff26-47e0-af7e-d47d0b9c2ffa",
  26.         "Authorization: Bearer " . $apiToken,
  27.     ),
  28. ));
  29.  
  30.  
  31. $response = curl_exec($curl);
  32. $err = curl_error($curl);
  33.  
  34. if ($err) {
  35.     echo "cURL Error #:" . $err;
  36. } else {
  37.     echo $response;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment