Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. <?php
  2.  
  3. if (isset($_REQUEST['email'])) {
  4. $url = "http://cliente.hostzone.com.br/includes/api.php"; # URL to WHMCS API file
  5. $username = ""; # Admin username goes here
  6. $password = ""; # Admin password goes here
  7.  
  8. $postfields["username"] = $username;
  9. $postfields["password"] = md5($password);
  10. $postfields["action"] = "OpenTicket"; #action performed by the [[API:Functions]]
  11. $postfields["deptid"] = "4";
  12. $postfields["email"] = $_REQUEST['email'];
  13. $postfields["name"] = $_REQUEST['nome'];
  14. $postfields["subject"] = "Contato no Site Hostzone";
  15. $postfields["message"] = $_REQUEST['comment'];
  16.  
  17. $ch = curl_init();
  18. curl_setopt($ch, CURLOPT_URL, $url);
  19. curl_setopt($ch, CURLOPT_POST, 1);
  20. curl_setopt($ch, CURLOPT_TIMEOUT, 100);
  21. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  22. curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
  23. $data = curl_exec($ch);
  24. curl_close($ch);
  25.  
  26. $data = explode(";",$data);
  27. foreach ($data AS $temp) {
  28. $temp = explode("=",$temp);
  29. $results[$temp[0]] = $temp[1];
  30. }
  31.  
  32. if ($results["result"]=="success") {
  33. echo "<script>alert('Mensagem enviada com sucesso!');</script>";
  34. } else {
  35. # An error occured
  36. echo "Ocorreu um erro: ".$results["message"];
  37. }
  38.  
  39. }
  40.  
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement