Guys I'm trying to subscribe to a topic in a cloudmqtt freebie server. Server: cloudMQTT
library: phpMQTT.php
publishing the topic seems to be working flawlessly, but it gives me the following error whenever i execute the php file
Error:
Fatal error: Maximum execution time of 30 seconds exceeded in F:\xampp\htdocs\bus_track\live\phpMQTT.php on line 321
PHP Code:
<?php
require("phpMQTT.php");
$server = "***.cloudmqtt.com";
$port = ******;
$username = "*******";
$password = "********";
$mqtt = new bluerhinos\phpMQTT($server, $port, "ClientID".rand());
//$top=$_GET['topic'];
if(!$mqtt->connect(true,NULL,$username,$password)){
exit(1);
}
$topics["sensor/temp"] = array("qos"=>0, "function"=>"procmsg");
$mqtt->subscribe($topics,0);
while($mqtt->proc()){
}
$mqtt->close();
function procmsg($topic,$msg){
echo "Msg Recieved: $msg";
}
?>