I am using ponte node application for sending MQTT notification from web to devices and please see below the format I am using.
"http://www.example.com/resources/topic/" and message as body while testing from postman. My question is how can i send qos and retain parameter while sendin MQTT notification using PHP CURL ? My PHP code is below.
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_PORT => self::MQTT_SERVER_PORT,
CURLOPT_URL => self::MQTT_SERVER_URL.'/'.$topic,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => "test message"
));
curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if(!$err){
$sent = true;
}
Regards, Tismon Varghese.