From 21204eb2a2a1ff94a337db1749b79ca1a1c2b046 Mon Sep 17 00:00:00 2001 From: Nikolai Gulatz Date: Fri, 20 Feb 2015 15:06:50 +0100 Subject: [PATCH 1/2] Added SSL-Support --- lib/XmppBosh.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/XmppBosh.php b/lib/XmppBosh.php index 560d1d1..8a51d0c 100644 --- a/lib/XmppBosh.php +++ b/lib/XmppBosh.php @@ -420,6 +420,13 @@ private function replyToChallengeResponse($challengeResponse) { */ private function send($xml) { $ch = curl_init($this->url); + + // Set SSL options + if($this->useSSL) { + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); + } + curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $xml); From 928758fb1ac3f2c93e38ad6ac5a8cb0c992acb01 Mon Sep 17 00:00:00 2001 From: ken restivo Date: Tue, 10 Nov 2015 00:34:04 -0800 Subject: [PATCH 2/2] This is the correct path (on OpenFire and ejabberd) to the auth mechanisms. --- lib/XmppBosh.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/XmppBosh.php b/lib/XmppBosh.php index 560d1d1..1f0140e 100644 --- a/lib/XmppBosh.php +++ b/lib/XmppBosh.php @@ -93,7 +93,7 @@ public function connect($node = null, $password = null) { $response = $this->sendInitConnection(); $body = self::getBodyFromXml($response); $this->sid = $body->getAttribute('sid'); - $mechanisms = $body->firstChild->firstChild->getElementsByTagName('mechanism'); + $mechanisms = $body->firstChild->getElementsByTagName('mechanism'); foreach ($mechanisms as $value) { $this->mechanisms[] = $value->nodeValue;