From 145f3d662fa869de17fb779bb26a1595d58fe45c Mon Sep 17 00:00:00 2001 From: denis-b Date: Mon, 10 Jan 2022 19:23:26 +0100 Subject: [PATCH 1/2] Pass Curl options Allow passing curl options, for example for proxy settings. --- src/BigBlueButton.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/BigBlueButton.php b/src/BigBlueButton.php index 66b11284..d46677e0 100644 --- a/src/BigBlueButton.php +++ b/src/BigBlueButton.php @@ -65,13 +65,14 @@ class BigBlueButton * @param null $baseUrl * @param null $secret */ - public function __construct($baseUrl = null, $secret = null) + public function __construct($baseUrl = null, $secret = null, $opts = null) { // Keeping backward compatibility with older deployed versions // BBB_SECRET is the new variable name and have higher priority against the old named BBB_SECURITY_SALT $this->securitySecret = $secret ?: getenv('BBB_SECRET') ?: getenv('BBB_SECURITY_SALT'); $this->bbbServerBaseUrl = $baseUrl ?: getenv('BBB_SERVER_BASE_URL'); $this->urlBuilder = new UrlBuilder($this->securitySecret, $this->bbbServerBaseUrl); + $this->curlopts = $opts['curl'] ?? []; } /** @@ -396,6 +397,14 @@ public function setJSessionId($jSessionId) $this->jSessionId = $jSessionId; } + /** + * @param array $curlopts + */ + public function setCurlOpts($curlopts) + { + $this->curlopts = $curlopts; + } + /* ____________________ INTERNAL CLASS METHODS ___________________ */ /** From 9e2dbdf8a6773c47c5efd1b2ef0cf66824d5351d Mon Sep 17 00:00:00 2001 From: denis-b Date: Mon, 10 Jan 2022 20:59:30 +0100 Subject: [PATCH 2/2] assign curl options --- src/BigBlueButton.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/BigBlueButton.php b/src/BigBlueButton.php index d46677e0..5a1f7f89 100644 --- a/src/BigBlueButton.php +++ b/src/BigBlueButton.php @@ -429,6 +429,9 @@ private function processXmlResponse($url, $payload = '', $contentType = 'applica $cookiefile = tmpfile(); $cookiefilepath = stream_get_meta_data($cookiefile)['uri']; + foreach ($this->curlopts as $opt => $value){ + curl_setopt($ch, $opt, $value); + } curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1); curl_setopt($ch, CURLOPT_ENCODING, 'UTF-8'); curl_setopt($ch, CURLOPT_URL, $url);