Advertisement
Guest User

Untitled

a guest
Aug 9th, 2017
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <?php
  2. $whmcsUrl = "http://srkhost.eu/";
  3.  
  4. $username = "username";
  5. $password = "password";
  6.  
  7. $postfields = array (
  8.     'username' => $username,
  9.     'password' => $password,
  10.     'action' => 'GetClients',
  11.     'responsetype' => 'json',
  12. );
  13.  
  14. $ch = curl_init();
  15. curl_setopt($ch, CURLOPT_URL, $whmcsUrl . 'includes/api.php');
  16. curl_setopt($ch, CURLOPT_POST, 1);
  17. curl_setopt($ch, CURLOPT_TIMEOUT, 30);
  18. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  19. curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
  20. curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);
  21. curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postfields));
  22. $response = curl_exec($ch);
  23. if (curl_error($ch))
  24. {
  25.     die('Unable to connect: ' . curl_errno($ch) . ' - ' . curl_error($ch));
  26. }
  27. curl_close($ch);
  28. $jsonData = json_decode($response, true);
  29. echo '<pre>';
  30. var_dump($jsonData);
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement