Skip to content

Commit 6d9eeaa

Browse files
authored
Update BigBlueButton.php
1 parent b6a0cc7 commit 6d9eeaa

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/BigBlueButton.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class BigBlueButton
6060
protected $bbbServerBaseUrl;
6161
protected $urlBuilder;
6262
protected $jSessionId;
63-
public $timeOut = 10;
63+
protected $timeOut = 10;
6464

6565
/**
6666
* BigBlueButton constructor.
@@ -459,6 +459,7 @@ private function processXmlResponse($url, $payload = '', $contentType = 'applica
459459
if (!$ch) {
460460
throw new \RuntimeException('Unhandled curl error: ' . curl_error($ch));
461461
}
462+
$timeout = 10;
462463

463464
// Needed to store the JSESSIONID
464465
$cookiefile = tmpfile();
@@ -469,7 +470,7 @@ private function processXmlResponse($url, $payload = '', $contentType = 'applica
469470
curl_setopt($ch, CURLOPT_URL, $url);
470471
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
471472
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
472-
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $this->timeOut);
473+
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
473474
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookiefilepath);
474475
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookiefilepath);
475476
if (!empty($payload)) {
@@ -491,6 +492,7 @@ private function processXmlResponse($url, $payload = '', $contentType = 'applica
491492
throw new BadResponseException('Bad response, HTTP code: ' . $httpcode);
492493
}
493494
curl_close($ch);
495+
unset($ch);
494496

495497
$cookies = file_get_contents($cookiefilepath);
496498
if (strpos($cookies, 'JSESSIONID') !== false) {
@@ -503,4 +505,15 @@ private function processXmlResponse($url, $payload = '', $contentType = 'applica
503505
throw new \RuntimeException('Post XML data set but curl PHP module is not installed or not enabled.');
504506
}
505507
}
508+
509+
/**
510+
* Set Curl Timeout (Optional), Default 10 Seconds
511+
* @param int $TimeOutInSeconds
512+
* @return static
513+
*/
514+
public function setTimeOut($TimeOutInSeconds)
515+
{
516+
$this->timeOut = $TimeOutInSeconds;
517+
return $this;
518+
}
506519
}

0 commit comments

Comments
 (0)