3939use BigBlueButton \Responses \IsMeetingRunningResponse ;
4040use BigBlueButton \Responses \JoinMeetingResponse ;
4141use BigBlueButton \Responses \PublishRecordingsResponse ;
42+ use BigBlueButton \Responses \SetConfigXMLResponse ;
4243use BigBlueButton \Responses \UpdateRecordingsResponse ;
4344use BigBlueButton \Util \UrlBuilder ;
4445use SimpleXMLElement ;
@@ -67,7 +68,9 @@ public function __construct()
6768 */
6869 public function getApiVersion ()
6970 {
70- return new ApiVersionResponse ($ this ->processXmlResponse ($ this ->urlBuilder ->buildUrl ()));
71+ $ xml = $ this ->processXmlResponse ($ this ->urlBuilder ->buildUrl ());
72+
73+ return new ApiVersionResponse ($ xml );
7174 }
7275
7376 /* __________________ BBB ADMINISTRATION METHODS _________________ */
@@ -118,6 +121,27 @@ public function getDefaultConfigXML()
118121 return new GetDefaultConfigXMLResponse ($ xml );
119122 }
120123
124+ /**
125+ * @return string
126+ */
127+ public function setConfigXMLUrl ()
128+ {
129+ return $ this ->urlBuilder ->buildUrl (ApiMethod::SET_CONFIG_XML , '' , false );
130+ }
131+
132+ /**
133+ * @return SetConfigXMLResponse
134+ * @throws \RuntimeException
135+ */
136+ public function setConfigXML ($ setConfigXMLParams )
137+ {
138+ $ setConfigXMLPayload = $ this ->urlBuilder ->buildQs (ApiMethod::SET_CONFIG_XML , $ setConfigXMLParams ->getHTTPQuery ());
139+
140+ $ xml = $ this ->processXmlResponse ($ this ->setConfigXMLUrl (), $ setConfigXMLPayload , 'application/x-www-form-urlencoded ' );
141+
142+ return new SetConfigXMLResponse ($ xml );
143+ }
144+
121145 /**
122146 * @param $joinMeetingParams JoinMeetingParameters
123147 *
@@ -333,7 +357,7 @@ public function updateRecordings($recordingParams)
333357 * @return SimpleXMLElement
334358 * @throws \RuntimeException
335359 */
336- private function processXmlResponse ($ url , $ xml = '' )
360+ private function processXmlResponse ($ url , $ xml = '' , $ contentType = ' application/xml ' )
337361 {
338362 if (extension_loaded ('curl ' )) {
339363 $ ch = curl_init ();
@@ -346,13 +370,13 @@ private function processXmlResponse($url, $xml = '')
346370 curl_setopt ($ ch , CURLOPT_URL , $ url );
347371 curl_setopt ($ ch , CURLOPT_RETURNTRANSFER , 1 );
348372 curl_setopt ($ ch , CURLOPT_CONNECTTIMEOUT , $ timeout );
349- if (count ( $ xml) !== 0 ) {
373+ if ($ xml != '' ) {
350374 curl_setopt ($ ch , CURLOPT_HEADER , 0 );
351375 curl_setopt ($ ch , CURLOPT_CUSTOMREQUEST , 'POST ' );
352376 curl_setopt ($ ch , CURLOPT_POST , 1 );
353377 curl_setopt ($ ch , CURLOPT_POSTFIELDS , $ xml );
354378 curl_setopt ($ ch , CURLOPT_HTTPHEADER , [
355- 'Content-type: application/xml ' ,
379+ 'Content-type: ' . $ contentType ,
356380 'Content-length: ' . strlen ($ xml ),
357381 ]);
358382 }
0 commit comments