[vz-users] JSON Abfrage PHP

Alexander Held aheld at protonmail.com
Fri Jan 22 22:22:36 CET 2016


Hallo zusammen,

ich versuche mich an einer Abfrage der "consumption"-Werte vie PHP und komme nicht weiter. Ich möchte dass lediglich die Verbrauchswerte ausgegeben werden. Leider funktionert das nicht.

<?php
$url = 'http://vz.xxxx.de/middleware.php/data/010f5190-83a4-11e4-98cd-d9350366ee4b.json?from=1+year+ago&group=day&tuples=1';
$string = file_get_contents($url, true);
$result = json_decode($string);
echo $result->consumption;
?>

Es wird nichts ausgegeben.

var_dump ergibt das Folgende:

object(stdClass)#1 (2) { ["version"]=> string(3) "0.3" ["data"]=> object(stdClass)#2 (9) { ["uuid"]=> string(36) "010f5190-83a4-11e4-98cd-d9350366ee4b" ["from"]=> float(1421966068136) ["to"]=> float(1453495268704) ["min"]=> array(2) { [0]=> float(1453495268704) [1]=> float(26.978647878035) } ["max"]=> array(2) { [0]=> float(1453495268704) [1]=> float(26.978647878035) } ["average"]=> float(26.979) ["consumption"]=> int(236282) ["rows"]=> int(362) ["tuples"]=> array(1) { [0]=> array(3) { [0]=> float(1453495268704) [1]=> float(26.979) [2]=> int(30649) } } } }

Bin sehr dankbar für etwaige Tipps! Schönes Wochenende.
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://demo.volkszaehler.org/pipermail/volkszaehler-users/attachments/20160122/d26d4648/attachment.html>


More information about the volkszaehler-users mailing list