Advertisement
Guest User

Untitled

a guest
Apr 28th, 2016
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. <?
  2. $whmusername = "root";
  3. $whmpassword = "HASŁO";
  4.  
  5. $query = "https://s1.hosted.pl:2087/json-api/listaccts?api.version=1";
  6.  
  7. $curl = curl_init(); // Create Curl Object
  8. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0); // Allow self-signed certs
  9. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0); // Allow certs that do not match the hostname
  10. curl_setopt($curl, CURLOPT_HEADER,0); // Do not include header in output
  11. curl_setopt($curl, CURLOPT_RETURNTRANSFER,1); // Return contents of transfer on curl_exec
  12. $header[0] = "Authorization: Basic " . base64_encode($whmusername.":".$whmpassword) . "\n\r";
  13. curl_setopt($curl, CURLOPT_HTTPHEADER, $header); // set the username and password
  14. curl_setopt($curl, CURLOPT_URL, $query); // execute the query
  15. $result = curl_exec($curl);
  16. if ($result == false) {
  17. error_log("curl_exec threw error \"" . curl_error($curl) . "\" for $query");
  18. // log error if curl exec fails
  19. }
  20. curl_close($curl);
  21.  
  22. print $result;
  23.  
  24. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement