Skip to content

Commit

Permalink
Update post request handler
Browse files Browse the repository at this point in the history
  • Loading branch information
sanduhrs committed Aug 4, 2020
1 parent e6d72b2 commit a6abadb
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/BigBlueButton/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,9 +337,12 @@ public function get($call, $options = [])
* @return string
* The xml formatted server response string.
*/
public function postRaw($call, $options = [])
public function postRaw($call, $options = [], $content_type = 'application/xml')
{
$uri = $this->generateURI($call, $options, false);
$uri = $this->generateURI($call, [], false);
$body = isset($options['body']) ? $options['body'] : '';
unset($options['body']);

$options = $this->prepareQueryOptions($options);
$options += [
'checksum' => $this->checksum($call, $options),
Expand All @@ -348,9 +351,11 @@ public function postRaw($call, $options = [])
'POST',
$uri,
[
'form_params' => $options,
'query' => $options,
'body' => $body,
'headers' => [
'Content-Type' => 'application/xml',
'Content-Type' => $content_type,
'Content-Length' => mb_strlen($body),
],
]
);
Expand All @@ -370,9 +375,9 @@ public function postRaw($call, $options = [])
* @return string
* The json formatted server response string.
*/
public function post($call, $options = [])
public function post($call, $options = [], $body = '')
{
$raw = $this->postRaw($call, $options);
$raw = $this->postRaw($call, $options, $body);
$xml = simplexml_load_string($raw);

list($element) = $xml->xpath('/*/returncode');
Expand Down

0 comments on commit a6abadb

Please sign in to comment.