Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function postWL($auth_token,$player){
- if($auth_token != NULL && $player != NULL){
- $authorization = 'Authorization: Bearer '.$auth_token;
- $url = 'https://data.cftools.cloud/v1/server/8839e72b-c343-4405-a36a-7ab31135dced/whitelist';
- $curl = curl_init($url);
- $auth_data = array(
- 'cftools_id' => $player,
- 'comment' => 'none',
- );
- $headers = array(
- 'Content-Type: application/json',
- $authorization,
- );
- curl_setopt($curl, CURLOPT_POST, 1);
- curl_setopt($curl, CURLOPT_POSTFIELDS, $auth_data);
- curl_setopt($curl, CURLOPT_URL, $url);
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
- curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
- curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
- $result = curl_exec($curl);
- if(!$result){die("Connection Failure");}
- curl_close($curl);
- echo($result);
- //if($result){return 'OK';}else{return 'BAD';}
- }else{
- return 'BAD';
- }
- }
Add Comment
Please, Sign In to add comment