Bläddra i källkod

test

station_14109
altob.rd 8 år sedan
förälder
incheckning
3034eefb22
1 ändrade filer med 4 tillägg och 3 borttagningar
  1. +4
    -3
      coworker/mqtt_service.php

+ 4
- 3
coworker/mqtt_service.php Visa fil

@@ -63,8 +63,9 @@ $mqtt = new phpMQTT($mqtt_ip, $mqtt_port, uniqid());
if(!$mqtt->connect()){ die ('Could not connect mqtt'); }

// 場站資料庫資訊
$topics['#'] = array('qos'=>2, 'function'=>'procmsg');
$mqtt->subscribe($topics, 2);
$topics['#'] = array('qos'=> 0, 'function'=>'procmsg');
$mqtt->subscribe($topics, 0);
trigger_error("..mqtt subscribe..".print_r($topics, true));

while($mqtt->proc()){ }
$mqtt->close();
@@ -80,5 +81,5 @@ function procmsg($topic, $msg)
curl_setopt($ch, CURLOPT_URL, 'http://localhost/carpark.html/mqtt_service/');
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
$result = curl_exec($ch);
trigger_error( __FUNCTION__ . "..{$topic}|{$msg}..curl:{$result}..");
trigger_error("..{$topic}|{$msg}..curl:{$result}..");
}

Laddar…
Avbryt
Spara