bluerhinos / phpMQTT

a simple php class to connect/publish/subscribe to a MQTT broker
Other
765 stars 461 forks source link

Can't connect to aws iot : Notice: Uninitialized string offset: 0 #97

Open hussainbadusha opened 4 years ago

hussainbadusha commented 4 years ago

Hi, I"ve been trying to connect to my aws iot thing

`require_once "../phpMQTT.php"; $server = "mythingid-ats.iot.us-east-2.amazonaws.com"; $port = 8883; $username = ""; $password = ""; $client_id = "client-iot-thing-" . time();

$mqtt = new phpMQTT($server, $port, $client_id); $mqtt->debug = true;

if(!$mqtt->connect(true, NULL)) { exit('Connection Failed'); } exit('Connection success');`

This are errors **Notice: Uninitialized string offset: 0 in D:\MyBelongings\PHP7\htdocs\composer\mqtt\vendor\bluerhinos\phpmqtt\phpMQTT.php on line 124

Notice: Uninitialized string offset: 0 in D:\MyBelongings\PHP7\htdocs\composer\mqtt\vendor\bluerhinos\phpmqtt\phpMQTT.php on line 128

Notice: Uninitialized string offset: 3 in D:\MyBelongings\PHP7\htdocs\composer\mqtt\vendor\bluerhinos\phpmqtt\phpMQTT.php on line 128 Exit**

Fyi, i tried this solution but it didn't solve the problem and still it displays the error https://github.com/bluerhinos/phpMQTT/issues/48

Any help would be appreciable Thanks, Hussain