Open 204maker opened 2 years ago
What information needs to be on the "youraddress" line on the curl command?
Hi, @204maker
Sorry for the long answer. Your address is the address where this script is located.
For example: 'curl "http://localhost/main.php?key=1234&ChargeBoxID=Ecc029&cmd=getConnectorState&ConnectorID=2"' 'curl "http://localhost:8090/main.php?key=1234&ChargeBoxID=Ecc029&cmd=getConnectorState&ConnectorID=2"' 'curl "http://mydomain.com/main.php?key=1234&ChargeBoxID=Ecc029&cmd=getConnectorState&ConnectorID=2"' 'curl "http://192.168.1.1:8090/main.php?key=1234&ChargeBoxID=Ecc029&cmd=getConnectorState&ConnectorID=2"'
I have hosted this script on a web host. To run php scripts on your own computer, you must have a local web server or php interpreter installed.
https://stackoverflow.com/questions/8580273/how-to-run-php-files-on-my-computer
Apache or XAMPP are one common choice. Next, you place main.php in a folder (for XAMPP, the path is described there), and specify 'localhost' in your address.
@204maker,
Instruction (checked on my PC):
Changed the web server port from 80 to 8080.
Put the configured script 'main.php' in your web server folder. On the XAMPP panel on the "Explorer" button, the "htdocs" folder. We put our script there.
Launch Apache (Start). If it has started, it will light up green.
You can refer to the script through cmd or a browser. In "youraddress" we specify "localhost:8080"
Example: 'curl "http://localhost:8080/main.php?key=1234&ChargeBoxID=Ecc029&cmd=getConnectorState&ConnectorID=2"' Should return the state of the plug.
Thank you @DeltaVetal26. It worked! The step-by-step instructions were super helpful. Thanks a lot.
@204maker , You are welcome. I'm glad it worked out ;)
Hi. I'm trying to use the main.php
script to simulate REST request to steve, but I'm new in php and I've some problems. Can anyone help me to understand how to run this script?
I'm using Linux, I've already installed php and curl, and I downloaded the main.php
file (now it is in my /home
folder). My pc is 192.168.1.10, whereas steve is running on another pc on my local network (IP: 192.168.1.12) and I would to run the main.php
script to simulate a start transaction using:
> curl "http://youraddress/main.php?key=YourKey&ChargeBoxID=001&cmd=RemoteStartTransaction&ConnectorID=2&idTag=ABCDE"
what is the <youraddress>
that I've to use? Have I to use my ip address, like:
> curl "http://192.168.1.10/main.php?key=YourKey&ChargeBoxID=001&cmd=RemoteStartTransaction&ConnectorID=2&idTag=ABCDE"
?
I've modified the parameters in main.php
as follow:
$steveServerAddres = 'http://192.168.1.12:8080';
$steveLogin = 'admin';
$stevePass = '1234';
$authKey = '123456789abc'; <-- random value or it must be equal to something?
$ocppProtocol = 'JSON'; // or JSON
$ocppVersion = 'v1.6'; // or 1.6
$supervision = 'steve';
// Only for SOAP use - charge point endpoint url
// Write here your charge point endpoint url
$endpointURL = 'http://localhost:9090/ocpp'; // (ex: http://localhost:9090/ocpp) <-- who is it?
Does YourKey
have to match with authKey
?
Thanks for your help, I'm very confused about it!
How do I use the script with a computer running on Windows 10?