Ja, ich schicke das über PHP zum Warp.
<?php
$d1 = $_GET["d1"];
$d2 = substr ($d1 , 0,3);
echo $d2;
$heute = date("M-d.h:i");
$filename = "warp/warp-".date("d").".csv";
$contents = file_get_contents('warp/warp.txt');
echo $contents;
$contents = substr ($contents , 0,2);
$pos = strpos($d2,$contents);
echo $pos;
if ($pos !== false){
echo "Zustand hat sich nicht geändert";
echo $pos;
$filestatus = file_put_contents("warp/nicht_geaendert-".date("m-d").".jur",$heute."\r\n",FILE_APPEND);
exit;
}
$uhrzeit = date("H:i");
$inhalt = $heute.";".$uhrzeit.";".$d1."\r\n";
$filestatus = file_put_contents($filename,$inhalt,FILE_APPEND);
echo $inhalt;
if ($d1 == 'ein'){
$url = "http://192.168.0.140/evse/start_charging";
$filestatus = file_put_contents('warp/warp.txt','ein');
senden($url);
}
if ($d1 == 'aus'){
$url = "http://192.168.0.140/evse/stop_charging";
$filestatus = file_put_contents('warp/warp.txt','aus');
senden($url);
}
function senden($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE);
curl_setopt($ch, CURLOPT_CAINFO, "/volume1/web/cacert.pem");
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_ENCODING, "");
curl_setopt($ch, CURLOPT_COOKIEFILE, getcwd() . '/cookies.cookie');
curl_setopt($ch, CURLOPT_COOKIEJAR, getcwd() . '/cookies.cookie');
curl_setopt($ch, CURLOPT_USERAGENT, "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.9.2.18) Gecko/20110614 Firefox/3.6.18");
if (strtolower($type) == 'post') {
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HEADER, true);
}
$content = curl_exec($ch);
$ergebnis = curl_error ($ch );
echo $ergebnis."\r\n";
curl_close($ch);
return $content;
}
?>