Closed yeziyuan closed 4 years ago
看看网络通不通,或者试一下客户端。 maybe network error,or use the client
先看看 相关参数是否正确,下个mqtt.fx测试 ,phpmqtt只支持mqttv3.1,有的mq是3.1.1的需要修改代码
I am restarting this project so having a clear out of old issues (If you believe this is still valid please reopen)
使用PHP调用MQTT.PHP,连接不上服务器,最后的结果是time out! $client_id = "phpMQTT-publisher"; // make sure this is unique for connecting to sever - you could use uniqid() $server = "xxxxx"; // change if necessary $port = xxxxx; // change if necessary $username = "xxxxx"; // set your username $password = "xxxxx"; $mqtt = new phpMQTT($server, $port, $client_id);
if ($mqtt->connect(true, NULL, $username, $password)) { $mqtt->publish("bluerhinos/phpMQTT/examples/publishtest", "Hello World! at " . date("r"), 0); $mqtt->close(); } else { echo "Time out!\n"; }