Phoenix wrote:Ok, i've tried it with a PHP script...it WORKS perfectly!!
See here:
http://phoenixinteractive.mine.nu/websi ... p=117#p117
The PHP code:
Code: Select all
<?php
// A PHP script to switch Plugwise Circles with a Stretch 2.0 (tested on firmware 1.0.40)
// Version 1.0, 2013-04-28 by Sebastiaan Ebeltjes
// Greetings from Deventer, The Netherlands
// Stretch 2.0 setup
$StretchIp = "192.168.1.102"; //The IP adres of the Stretch 2.0, like: 192.168.1.X
$StretchId = "STRETCHID"; //The 8 letters of the Stretch 2.0 ID
// Switch setup (circle)
$ApplianceId = "71abf031c54f400ca77c8ae6957ad7cf"; // The ID of the circle, look in http://[STRETCHIP]/minirest/appliances
$SwitchStatus = "on"; // on/off
// Kernel
$AuthBase64 = base64_encode("stretch:".$StretchId);
$HTTPHandle = fsockopen($StretchIp, 80, $errno, $errstr, 30);
if (!$HTTPHandle) {
echo "$errstr ($errno)<br />\n";
} else {
$Data = "POST /minirest/appliances;id=".$ApplianceId."/power_state=".$SwitchStatus." HTTP/1.1\r\n";
$Data .= "Host: ".$StretchIp."\r\n";
$Data .= "Authorization: Basic ".$AuthBase64."\r\n";
$Data .= "\r\n";
fwrite($HTTPHandle, $Data);
while (!feof($HTTPHandle)) {
echo fgets($HTTPHandle, 128);
}
fclose($HTTPHandle);
}
?>
Enjoy!
Ps. now transforming it to a Autoit/VB code...

Hey Phoenix
I'm trying to follow your php script ... but mine is going into infinite loop ....
I have to desactivate this :
//fwrite($HTTPHandle, $Data);
//while (!feof($HTTPHandle)) {
//echo fgets($HTTPHandle, 128);
//}
//fclose($HTTPHandle);
and doing an echo for $Data : i have this on the html page result :
POST /minirest/appliances;id=5q4d1sf65sd14f56sd14f56sdf1g45dsfg64151116451/power_state=on HTTP/1.1 Host: 192.168.0.11 Authorization: Basic q65s41df564qsd1f54qds1==
seems ok for you ?
Many thanks for your help and reading
