i'm starting on cPanel API and have a problem, this is my code:
$user = 'username';
$pass = 'password';
$host = 'xxx.xxx.xxx.xxx';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $host);
$header[0] = "Authorization: Basic " . base64_encode($user . ":" . $pass) . "\n\r";
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_PORT, 2083);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "user=$user&pass=$pass");
curl_setopt($ch, CURLOPT_TIMEOUT, 100020);
$f = curl_exec($ch);
$h = curl_getinfo($ch);
echo $h['url'];
curl_close($ch);
this code show: "https://server.mydomain.com:2083/frontend/paper_lantern/index.html".
I need "cpsessxxxxxxxxx" for the correct link.
OBS: I searched here and see some topics, i tried some codes, but dont work... please if someone have a solution, help me if possible. Thanks all
and have a nice day
$user = 'username';
$pass = 'password';
$host = 'xxx.xxx.xxx.xxx';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $host);
$header[0] = "Authorization: Basic " . base64_encode($user . ":" . $pass) . "\n\r";
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_PORT, 2083);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "user=$user&pass=$pass");
curl_setopt($ch, CURLOPT_TIMEOUT, 100020);
$f = curl_exec($ch);
$h = curl_getinfo($ch);
echo $h['url'];
curl_close($ch);
this code show: "https://server.mydomain.com:2083/frontend/paper_lantern/index.html".
I need "cpsessxxxxxxxxx" for the correct link.
OBS: I searched here and see some topics, i tried some codes, but dont work... please if someone have a solution, help me if possible. Thanks all