Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
hi
i have x-ui(v2ray) webpanel and i want to create a account in it with a php command  

how can i login to the panel and create account with php?
this is the panel of x-ui = [panel](http://65.109.130.39/)


What I have tried:

i have tried many times but i dont have any idea to login to the webpanel with php  
Posted
Updated 2-Apr-23 7:05am
Comments
Richard MacCutchan 3-Dec-22 12:52pm    
You need to study the documentation for x-ui (whatever that is).

1 solution

class v2Ray
{
private $host;
private $port;
private $username;
private $password;

function __construct($host, $port, $username, $password)
{
$this->host = $host;
$this->port = $port;
$this->username = $username;
$this->password = $password;
if (!file_exists('./.cookie.txt')) $this->login();
}
private function login()
{
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'http://' . $this->host . ':' . $this->port . '/login',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_COOKIEFILE => './.cookie.txt',
CURLOPT_COOKIEJAR => './.cookie.txt',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => 'password=' . $this->password . '&username=' . $this->username . '',
));
$response = curl_exec($curl);
curl_close($curl);
return $response;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900