I connect to an application for a push/stream data.
With the following code I have a right answer from the app (outcome=OK|item=THEITEM) but can't figure out how to get the var "last_value" and its updates. The loop is commented out, I have no echo with it (loop)
$port = ('5333');
$address = ('127.0.0.1');
$fp = stream_socket_client("tcp://$address:$port", $errno, $errstr, 1);
if (!$fp) {
echo "$errstr ($errno)<br />
";
} else {
$in = "function=subscribe|item=THEITEM|schema=last_value";
fwrite($fp, $in."
");
//while (!feof($fp)) {
echo fgets($fp, 1024);
//}
fclose($fp);
}
This returns outcome=OK|item=THEITEM. The updates should be like THEITEM|last_value.