gravvy

Untitled

May 29th, 2021 (edited)
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. function postWL($auth_token,$player){
  2. if($auth_token != NULL && $player != NULL){
  3. $authorization = 'Authorization: Bearer '.$auth_token;
  4. $url = 'https://data.cftools.cloud/v1/server/8839e72b-c343-4405-a36a-7ab31135dced/whitelist';
  5. $curl = curl_init($url);
  6. $auth_data = array(
  7. 'cftools_id' => $player,
  8. 'comment' => 'none',
  9. );
  10. $headers = array(
  11. 'Content-Type: application/json',
  12. $authorization,
  13. );
  14. curl_setopt($curl, CURLOPT_POST, 1);
  15. curl_setopt($curl, CURLOPT_POSTFIELDS, $auth_data);
  16. curl_setopt($curl, CURLOPT_URL, $url);
  17. curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
  18. curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
  19. curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
  20. $result = curl_exec($curl);
  21. if(!$result){die("Connection Failure");}
  22. curl_close($curl);
  23. echo($result);
  24. //if($result){return 'OK';}else{return 'BAD';}
  25. }else{
  26. return 'BAD';
  27. }
  28. }
Add Comment
Please, Sign In to add comment