array(
'method'=>"GET",
'header'=>"Accept-language: en\r\n" .
"Authorization: Basic " . base64_encode("$smartmeUserName:$smartmePassword")
)
);
$context = stream_context_create($opts);
// Open the file using the HTTP headers set above
$smartme_output = file_get_contents($smartmeQuery, false, $context);
$response = json_decode($smartme_output, true);
$powerstate = $response[0]['SwitchOn'];
echo "Last updated: " . date('Y-m-d H:i:s', strtotime($response[0]['ValueDate'])) . "
";
echo "Name: " . $response[0]['Name'] . "
";
echo "Zählerstand komplett: " . $response[0]['CounterReading'] . " " . $response[0]['CounterReadingUnit'] . "
";
//echo "SwitchOn: " . $response[0]['SwitchOn'] . "
";
echo "