Open sijojamesjohn opened 1 year ago
Hello,
https://github.com/DeltaVetal26/SteVe-OCPP-HTTP-Client/issues/8 Have you updated Steve?
If you have the latest version of Steve, try installing an earlier version. They probably changed the structure of the page and that's why it doesn't work.
I'll check it out when I have time.
Hi, I've got the same issue. I can get the POST commands to work and create entries in Steve. All GET commands seem to fail and redirect back to the login. JSESSIONID cookie is being set and is correct. Looks like something is causing an invalid session but not sure what. Thanks for any help.
It is redirecting before it even reaches the page.
Hello. Sorry for delay.
Test conditions: 1) SteVe-3.6.0 2) OCPP v1.6 (JSON) 2) PHP 5.4.16-48.el7 (where is the script located)
Result:
1) Get connector state (From the browser):
Command: https://website.com/main.php?key=MyKey&ChargeBoxID=HVG15&cmd=getConnectorState&ConnectorID=1
Result:
2) Get connector state (cURL):
Command: curl "https://website.com/main.php?key=MyKey&ChargeBoxID=HVG15&cmd=getConnectorState&ConnectorID=1"
Result:
There are no other GET commands in this script. When testing on the latest version, it did not return the connector state (It was always "StateNotExist"). I fixed this in the update.
Did you get an error with the get connector state command?
Still getting the login page and the error is StateNotExist
steve 3.6.0 php 7.5 occp 1.6
I haven't found a PHP 7.5 version to test this with (After 7.4.33 there is already version 8.). I checked on PHP version 7.4.33 - OK. This script is not supported on PHP 8+.
As I understand it, all other commands work for you, with the exception of GET. I can't reproduce this issue. Do you have a PHP error log? Are there any errors when calling the script?
Perhaps the page does not have time to load and the command is already being sent. I can suggest trying to add a delay of a couple of seconds in the place where authorization is called.
Add sleep(3);
after calling the steveSignIn function (It's at the bottom of the script.)
UPD. Also add the content output to check in the steveSignIn function: Before:
function steveSignIn($login, $pass) {
global $curl, $steveServerAddres, $stevePathArray;
$content = curlConnectTo($steveServerAddres, $stevePathArray['signin']);
$token = getCSRFToken($content);
$form = "username=".$login."&password=".$pass."&_csrf=".$token."";
curl_setopt($curl, CURLOPT_POSTFIELDS, $form);
curl_exec($curl);
}
After:
function steveSignIn($login, $pass) {
global $curl, $steveServerAddres, $stevePathArray;
$content = curlConnectTo($steveServerAddres, $stevePathArray['signin']);
$token = getCSRFToken($content);
$form = "username=".$login."&password=".$pass."&_csrf=".$token."";
curl_setopt($curl, CURLOPT_POSTFIELDS, $form);
$checkContent = curl_exec($curl);
echo $checkContent;
}
Next, run this script through a browser asking for the connector status. What will be displayed there?
Hello there! Firts of all thanks for this little helpfull php. I was investigating why GET request weren't working, it's because when you use the sigin curl, it doesn't matter the URL you are pointing to, in the latests version, after signin, you go back to the "home/welcome" page, instead of logging in and loading the page you really requested
None of the GET commands are working. All of them are redirecting to the Signin page.