<?php

namespace App\Services;



class ClientDisconnectService
{
    public function disconnectExecute($userName,$ip,$secret, $isOnline = false)
    {
        $url = env('DISCONNECT_API_END_POINT')."/add-disconnect-job";


            $data = [
                "username" => $userName,
                "ip" => $ip,
                "secret" => $secret,
                "isOnline" =>$isOnline
            ];


            $jsonData = json_encode($data);

            $ch = curl_init($url);

            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_HTTPHEADER, [
                'Content-Type: application/json',
                'Content-Length: ' . strlen($jsonData)
            ]);

            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $jsonData);

            curl_exec($ch);
           

    }
}
