參考:https://github.com/bluerhinos/phpMQTT.gitphp
<?php require("../phpMQTT.php"); $mqtt = new phpMQTT("127.0.0.1", 1883, "phpMQTT Pub Example"); //Change client name to something unique if ($mqtt->connect()) { $mqtt->publish("/hello","Hello World! at ".date("r"),0); $mqtt->close(); } ?>
相比mosquittogit