Hi
is there a how to do it I have a php script where I can see the temparatur from the Zwave me by API
but after a new install it is not working any more
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,'http://192.168.1.69:8083/ZWaveAPI/Run/d ... .val.value');
echo "Stue = ";
$number = curl_exec($ch);
$number = sprintf('%.2f', $number);
echo $number;
echo " ℃";
?>
I have to login in now I have tryed everthing that I can fandt but nothing is working
the php page is on a other server, not the Raspberry pi
Claus
API login
Re: API login
Add your username and password separated with a colon into your url, like this:
http://username:password@192.168.1.69:8083/
http://username:password@192.168.1.69:8083/
Re: API login
it was tried but this is not working
if I tried it in a brower I get not logged in
if I tried it in a brower I get not logged in
Re: API login
Ok, if you are sure your credentials exist and are correct (you might want to double check this – easy to forget when reinstalling), then I suppose php curl doesn't support that kind of basic auth syntax. Try adding this instead, grouped with your other curl_setopt() calls:
curl_setopt($ch, CURLOPT_USERPWD, 'yourusername:yourpassword');
curl_setopt($ch, CURLOPT_USERPWD, 'yourusername:yourpassword');
Re: API login
Hi
can some one tell me how to put this code
curl_setopt($ch, CURLOPT_USERPWD, 'yourusername:yourpassword');
in my code, maybe there have to be more code, I cant get it to work
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,'http://192.168.1.69:8083/ZWaveAPI/Run/d ... .val.value');
echo "Stue = ";
$number = curl_exec($ch);
$number = sprintf('%.2f', $number);
echo $number;
echo " ℃";
?>
Claus
can some one tell me how to put this code
curl_setopt($ch, CURLOPT_USERPWD, 'yourusername:yourpassword');
in my code, maybe there have to be more code, I cant get it to work
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,'http://192.168.1.69:8083/ZWaveAPI/Run/d ... .val.value');
echo "Stue = ";
$number = curl_exec($ch);
$number = sprintf('%.2f', $number);
echo $number;
echo " ℃";
?>
Claus
Re: API login
hi
I have now get it to work with this code
<?php
$login = 'admin';
$password = 'password';
$url = 'http://192.168.20.250:8083/ZWaveAPI/Run ... .val.value';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "$login:$password");
$number = curl_exec($ch);
curl_close($ch);
echo "Stue = ";
$number = sprintf('%.2f', $number);
echo $number;
echo " ℃";
?>
claus
I have now get it to work with this code
<?php
$login = 'admin';
$password = 'password';
$url = 'http://192.168.20.250:8083/ZWaveAPI/Run ... .val.value';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_USERPWD, "$login:$password");
$number = curl_exec($ch);
curl_close($ch);
echo "Stue = ";
$number = sprintf('%.2f', $number);
echo $number;
echo " ℃";
?>
claus