usertum
Full Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору <?php $curl = curl_init(); $cookie_file = './cookies.txt'; curl_setopt_array($curl, array( CURLOPT_URL => 'http://127.0.0.1:2053/login', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => 'username=admin&password=admin', CURLOPT_COOKIEJAR => realpath($cookie_file), CURLOPT_COOKIEFILE => realpath($cookie_file), CURLOPT_COOKIE => realpath($cookie_file), )); $response = curl_exec($curl); curl_close($curl); echo $response; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => 'http://127.0.0.1/panel/api/inbounds/addClient', CURLOPT_COOKIEJAR => realpath($cookie_file), CURLOPT_COOKIEFILE => realpath($cookie_file), CURLOPT_COOKIE => realpath($cookie_file), CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 0, CURLOPT_FOLLOWLOCATION => true, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode([ 'id' => 1, 'settings' => json_encode([ 'clients' => [ [ 'id' => '95e4e7bb-7796-47e7-e8a7-f4055194f776', 'alterId' => 0, 'email' => 'New Client', 'limitIp' => 2, 'totalGB' => 42949672960, 'expiryTime' => 1682864675944, 'enable' => true, 'tgId' => '', 'subId' => '' ] ] ]) ]), CURLOPT_HTTPHEADER => array( 'Accept: application/json' ), )); $response = curl_exec($curl); curl_close($curl); echo $response; |