Node js Faye Client not working properly with HTTPS

£可爱£侵袭症+ 提交于 2019-12-08 08:00:29

I fixed issue my self, The issue was not in server side. It was in php Faye Client side. That Php Client works fine for HTTP server, but I need to use it for HTTPS server. I have done following changes then It works fine.

/vendor/nc/faye-client/src/Nc/FayeClient/Adapter/CurlAdapter.php

public function postJSON($url, $body)
{

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($curl, CURLOPT_POSTFIELDS, $body);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt ($curl, CURLOPT_SSL_VERIFYHOST, 0);
    curl_setopt ($curl, CURLOPT_SSL_VERIFYPEER, 0); 
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(
                'Content-Type: application/json',
                'Content-Length: ' . strlen($body),
            ));

    curl_exec($curl);
    curl_close($curl);
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!