Advertisement
Guest User

Untitled

a guest
Oct 15th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. <?php
  2.  
  3. $curl = curl_init();
  4. $accountID = 2;
  5.  
  6. $fields = [
  7. "apiKey" => "qse8kv2bh9kzhyay6pz4wo9v1m7rdbva",
  8. "action" => "createTicket",
  9. "ticketInfo" => [
  10. "type" => "Individual",
  11. "summary" => "PhoneTicket",
  12. "description" => "Needs HELP",
  13. "status" => 1,
  14. "responsibleGroupID" => 3,
  15. "category" => 1,
  16. "ticketType" => 42,
  17. "customerID" => $accountID,
  18. "customerViewable" => 0
  19. ]
  20. ];
  21.  
  22. curl_setopt_array($curl, array(
  23. CURLOPT_URL => "https://10.0.0.140:444/api/1/index.php",
  24. CURLOPT_RETURNTRANSFER => true,
  25. CURLOPT_TIMEOUT => 30,
  26. CURLOPT_CUSTOMREQUEST => "POST",
  27. CURLOPT_SSL_VERIFYPEER => false,
  28. CURLOPT_SSL_VERIFYHOST => false,
  29. CURLOPT_POSTFIELDS => http_build_query($fields),
  30. CURLOPT_HTTPHEADER => array(
  31. "Content-Type: application/x-www-form-urlencoded"
  32.  
  33. ),
  34. ));
  35.  
  36. echo('Create Ticket Posted');
  37. $response = curl_exec($curl);
  38.  
  39. $err = curl_error($curl);
  40. if (!empty($err)) {
  41. echo "Error with API call. " . $err . " - " . curl_errno($curl);
  42. }
  43.  
  44. echo('Create Ticket Postback');
  45.  
  46. if ($response) {
  47. $results = json_decode($response);
  48. echo("Create Ticket Response:" . PHP_EOL);
  49. var_dump($results);
  50. } else {
  51. echo('Create Ticket Post Failed');
  52. }
  53.  
  54. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement