I am developing website that will acquire data from a broker.
I am using this code on my localhost. On that it is working fine. But when i uploaded it on cpanel it is not connecting to the broker.
Your kind help is needed. Thanks in advance.
PHP:
<?php
require "phpMQTT.php";
$mqtt = new phpMQTT("b-e6439b20-3a80-4688-86b3-xxxxxxxxxxxxx-1.mq.ap-south-1.amazonaws.com", 8883,
"Emoncms feed subscriber",'ca.crt');
$username='mqtt';
$password='xxxxx';
$con=mysqli_connect("localhost","maria","Maria_1234567","energy_xxxxxxxxx");
if(!$mqtt->connect(true, NULL, $username, $password)) {
echo "Not connected";
}
else{
echo "connected";
}
?>
When i was working on xamp it was giving same error and i solved it by adding .crt file of apache and i uploaded the same file on cpanel. But i on cpanel i dont have any idea why it is not connecting.PHP Warning: stream_socket_client(): unable to connect to tlsv1.2://b-e6439b20-3a80-4688-86b3-0658535e5f2f-1.mq.ap-south-1.amazonaws.com:8883 (Connection refused) in /home/k43irmix6/public_html/phpMQTT.php on line 88
Your kind help is needed. Thanks in advance.
Last edited by a moderator: