<?
$data = httpQuery("http://192.168.1.30/gateway/apipublic/reportInstantaneousValues", 'GET');
$myXML = jsonToXML($data);
echo "1=".xpath($myXML, "substring-before(substring-after(//root/report , 'activePower='),' ')" );
echo "<br>2=";
var_dump($myXML);
?>
1=556.158
2=string(3329) " Instantaneous values:<BR>voltage=233.7 Vrms<BR>FFTComponents:<BR>Phase 1:<BR> current=2.506 A, activePower=556.158 W, reactivePower=184.365 var, apparentPower=585.92 VA, cosfi=94, quadrant=0, phaseshift=0.0, phaseDiff=0.0<BR> FFTComponents:<BR><BR>Load[185693] state[1] power: 977.5 on Tue Dec 08 13:49:06 GMT 2015<BR>Load[262961] state[0] power: 0.0 on Tue Dec 08 09:44:02 GMT 2015<BR>Load[186125] state[1] power: 135.0 on Fri Dec 04 10:11:17 GMT 2015<BR>Load[184801] state[1] power: 80.2 on Tue Dec 08 12:00:56 GMT 2015<BR>Load[274030] state[0] power: 0.0 on Fri Dec 04 10:08:16 GMT 2015<BR>Load[373854] state[0] power: 0.0 on Mon Dec 07 12:02:37 GMT 2015<BR>Load[184461] state[0] power: 0.0 on Tue Dec 08 15:05:07 GMT 2015<BR>Load[191946] state[1] power: 1297.5 on Tue Dec 08 13:50:25 GMT 2015<BR>Load[185694] state[1] power: 1476.7 on Tue Dec 08 11:21:08 GMT 2015<BR>Load[257520] state[1] power: 92.9 on Fri Dec 04 09:43:39 GMT 2015<BR>Load[194103] state[0] power: 0.0 on Tue Dec 08 11:23:36 GMT 2015<BR>Load[186878] state[0] power: 0.0 on Mon Dec 07 11:25:25 GMT 2015<BR>Load[185692] state[1] power: 2239.8 on Fri Dec 04 12:19:40 GMT 2015<BR>Load[350593] state[0] power: 0.0 on Mon Dec 07 18:08:27 GMT 2015<BR>Load[192188] state[0] power: 0.0 on Tue Dec 08 08:19:29 GMT 2015<BR>Load[274031] state[0] power: 0.0 on Fri Dec 04 09:59:46 GMT 2015<BR>Load[398912] state[0] power: 0.0 on Mon Dec 07 22:44:22 GMT 2015<BR>Load[370057] state[0] power: 0.0 on Sat Dec 05 09:16:20 GMT 2015<BR>Load[283660] state[0] power: 0.0 on Tue Dec 08 11:01:52 GMT 2015<BR>Load[227315] state[0] power: 0.0 on Mon Dec 07 13:14:02 GMT 2015<BR>Load[184264] state[0] power: 0.0 on Tue Dec 08 11:10:07 GMT 2015<BR>Load[291850] state[0] power: 0.0 on Fri Dec 04 18:23:56 GMT 2015<BR>Load[365187] state[0] power: 0.0 on Mon Dec 07 15:31:42 GMT 2015<BR>Load[246745] state[1] power: 97.0 on Tue Dec 08 11:09:01 GMT 2015<BR>Load[184800] state[1] power: 1154.3 on Tue Dec 08 13:52:56 GMT 2015<BR>Load[226430] state[1] power: 107.8 on Mon Dec 07 17:11:08 GMT 2015<BR>Load[184799] state[0] power: 0.0 on Sun Dec 06 12:25:07 GMT 2015<BR>Load[215957] state[1] power: 1401.5 on Tue Dec 08 12:08:33 GMT 2015<BR>Load[187552] state[1] power: 599.8 on Tue Dec 08 14:10:35 GMT 2015<BR>Load[313183] state[0] power: 0.0 on Mon Dec 07 17:11:44 GMT 2015<BR><BR>Phase 1, peak active power 5049.197 W at 28/11/2015 12:23:05<BR>active energy RMS per phase mapping combination<BR>phase mapping -1=0.0 kWh [* 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR><BR>active energy RMS (solar) per phase mapping combination<BR>phase mapping -1=0.0 kWh [* 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR><BR> "
XML error: 1=594.294<br>2=string(3330) "<?xml version="1.0" encoding="ISO-8859-1"?>
<root><report>
Instantaneous values:<BR>voltage=233.0 Vrms<BR>FFTComponents:<BR>Phase 1:<BR> current=2.666 A, activePower=594.294 W, reactivePower=181.586 var, apparentPower=621.417 VA, cosfi=95, quadrant=0, phaseshift=0.0, phaseDiff=0.0<BR> FFTComponents:<BR><BR>Load[185693] state[1] power: 977.5 on Tue Dec 08 13:49:06 GMT 2015<BR>Load[262961] state[0] power: 0.0 on Tue Dec 08 09:44:02 GMT 2015<BR>Load[186125] state[1] power: 135.0 on Fri Dec 04 10:11:17 GMT 2015<BR>Load[184801] state[1] power: 80.2 on Tue Dec 08 12:00:56 GMT 2015<BR>Load[274030] state[0] power: 0.0 on Fri Dec 04 10:08:16 GMT 2015<BR>Load[373854] state[0] power: 0.0 on Mon Dec 07 12:02:37 GMT 2015<BR>Load[184461] state[0] power: 0.0 on Tue Dec 08 15:05:07 GMT 2015<BR>Load[191946] state[1] power: 1297.5 on Tue Dec 08 13:50:25 GMT 2015<BR>Load[185694] state[1] power: 1476.7 on Tue Dec 08 11:21:08 GMT 2015<BR>Load[257520] state[1] power: 92.9 on Fri Dec 04 09:43:39 GMT 2015<BR>Load[194103] state[0] power: 0.0 on Tue Dec 08 11:23:36 GMT 2015<BR>Load[186878] state[0] power: 0.0 on Mon Dec 07 11:25:25 GMT 2015<BR>Load[185692] state[1] power: 2239.8 on Fri Dec 04 12:19:40 GMT 2015<BR>Load[350593] state[0] power: 0.0 on Mon Dec 07 18:08:27 GMT 2015<BR>Load[192188] state[0] power: 0.0 on Tue Dec 08 08:19:29 GMT 2015<BR>Load[274031] state[0] power: 0.0 on Fri Dec 04 09:59:46 GMT 2015<BR>Load[398912] state[0] power: 0.0 on Mon Dec 07 22:44:22 GMT 2015<BR>Load[370057] state[0] power: 0.0 on Sat Dec 05 09:16:20 GMT 2015<BR>Load[283660] state[0] power: 0.0 on Tue Dec 08 11:01:52 GMT 2015<BR>Load[227315] state[0] power: 0.0 on Mon Dec 07 13:14:02 GMT 2015<BR>Load[184264] state[0] power: 0.0 on Tue Dec 08 11:10:07 GMT 2015<BR>Load[291850] state[0] power: 0.0 on Fri Dec 04 18:23:56 GMT 2015<BR>Load[365187] state[0] power: 0.0 on Mon Dec 07 15:31:42 GMT 2015<BR>Load[246745] state[1] power: 97.0 on Tue Dec 08 11:09:01 GMT 2015<BR>Load[184800] state[1] power: 1154.3 on Tue Dec 08 13:52:56 GMT 2015<BR>Load[226430] state[1] power: 107.8 on Mon Dec 07 17:11:08 GMT 2015<BR>Load[184799] state[0] power: 0.0 on Sun Dec 06 12:25:07 GMT 2015<BR>Load[215957] state[1] power: 1401.5 on Tue Dec 08 12:08:33 GMT 2015<BR>Load[187552] state[1] power: 599.8 on Tue Dec 08 14:10:35 GMT 2015<BR>Load[313183] state[0] power: 0.0 on Mon Dec 07 17:11:44 GMT 2015<BR><BR>Phase 1, peak active power 5049.197 W at 28/11/2015 12:23:05<BR>active energy RMS per phase mapping combination<BR>phase mapping -1=0.0 kWh [* 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR><BR>active energy RMS (solar) per phase mapping combination<BR>phase mapping -1=0.0 kWh [* 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR>phase mapping -1=0.0 kWh [ 1/0]<BR><BR>
</report>
</root>"
<?
$activepower_id = getArg('activepower','-1');
$tension_id = getArg('tension','-1');
$data = httpQuery("http://192.168.1.30/gateway/apipublic/reportInstantaneousValues", 'GET');
$myXML = jsonToXML($data);
if ($activepower_id != '-1'){
$activepower = xpath($myXML, "substring-before(substring-after(//root/report , 'activePower='),' ')" );
setValue($activepower_id, $activepower, false);
}
if ($tension_id != '-1'){
$tension = xpath($myXML, "substring-before(substring-after(//root/report , 'voltage='),' ')" );
setValue($tension_id, $tension, false);
}
?>
## ERROR: XML invalid [].
<br />
<b>Warning</b>: DOMDocument::loadXML() [<a href='function.DOMDocument-loadXML'>function.DOMDocument-loadXML</a>]: Start tag expected, '<' not found in Entity, line: 1 in <b>/mnt/flash/puch/www/script/script_include.php</b> on line <b>277</b><br />
## ERROR: XML invalid [].
<?
$activepower_id = getArg('activepower','-1');
$tension_id = getArg('tension','-1');
$intensite_id = getArg('intensite','-1');
$data = httpQuery("http://192.168.1.30/gateway/apipublic/reportInstantaneousValues", 'GET');
$myXML = jsonToXML($data);
if ($activepower_id != '-1'){
$activepower = xpath($myXML, "substring-before(substring-after(//root/report , 'activePower='),' ')" );
setValue($activepower_id, $activepower, false);
}
if ($tension_id != '-1'){
$tension = xpath($myXML, "substring-before(substring-after(//root/report , 'voltage='),' ')" );
setValue($tension_id, $tension, false);
}
if ($intensite_id != '-1'){
$tension = xpath($myXML, "substring-before(substring-after(//root/report , 'current='),' ')" );
setValue($intensite_id, $intensite, false);
}
?>
Utilisateurs parcourant ce forum : Aucun utilisateur inscrit et 1 invité