Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //publish.php
- require("phpMQTT.php");
- $host = "10.0.99.94";
- $port = "1883";
- $username = "";
- $password = "";
- $message = "Hello CloudMQTT!";
- //MQTT client id to use for the device. "" will generate a client id automatically
- $mqtt = new phpMQTT($host, $port, "testSub".rand());
- if ($mqtt->connect(true,NULL,$username,$password)) {
- $mqtt->publish("debug",$message, 0);
- $mqtt->close();
- }else{
- echo "Fail or time out<br />";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement