Closed itvitacredit closed 2 years ago
Not working
$params = array(
"language" => "0",
"loginId" => "$login",
"password" => "$password",
);
$params=json_encode($params);
$headers = array(
"X-APP-TYPE: 1",
"X-APP-VERSION: 2.20.0",
"User-Agent: G-RAC",
"Accept: application/json",
"Content-Type: application/json;"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://accsmart.panasonic.com/auth/login");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_HEADER, TRUE);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
$response=json_decode($response, true);
print_r($response);
Answer for php
function CCLogin($login, $password){ $params = array( "language" => "0", "loginId" => "$login", "password" => "$password", ); $params=json_encode($params);
$headers = array(
"User-Agent: G-RAC",
"Accept-Encoding: gzip, deflate",
"Accept: application/json; charset=utf-8",
"Connection: keep-alive",
"X-APP-TYPE: 1",
"X-APP-VERSION: 1.19.0",
"Content-Type: application/json; charset=utf-8"
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://accsmart.panasonic.com/auth/login");
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
curl_close($ch);
$response=json_decode($response);
return $response;
}
This library is for Python, but it's possible to make it work elsewhere as well.
You may try to download VS Code and try to run some of the requests in https://github.com/lostfields/python-panasonic-comfort-cloud/blob/master/requests.http - you may use curl as well, but you have to rewrite them.
VS Code + REST Client will run these commands in sequence.
First login, by running the first request. Then run the second one to get the first device in the device list. After that you can run anyone of them, to see how it works
Hello May be there is in PHP or JS ? Or May be Document for REST API ?