SHARE
TWEET

Untitled

a guest May 19th, 2019 109 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $whmusername = "root";
  3. $hash = ""; // string lenght : 32
  4.  
  5. $user = "root";
  6. $service = "whostmgrd";
  7. $query = "https://host:2087/json-api/create_user_session?api.version=1&user={$user}&service={$service}";
  8.  
  9. $curl = curl_init();
  10. curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,0);
  11. curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,0);
  12. curl_setopt($curl, CURLOPT_RETURNTRANSFER,1);
  13.  
  14. $header[0] = "Authorization: WHM $whmusername:" . preg_replace("'(\r|\n)'","",$hash);
  15. curl_setopt($curl,CURLOPT_HTTPHEADER,$header);
  16. curl_setopt($curl, CURLOPT_URL, $query);
  17.  
  18. $result = curl_exec($curl);
  19. if ($result == false) {
  20.     error_log("curl_exec threw error \"" . curl_error($curl) . "\" for $query");
  21. }
  22. curl_close($curl);
  23.  
  24. print $result.PHP_EOL;
  25. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top