From 20ade83792ffe6f04e8a7381a4f3dfd1dc605141 Mon Sep 17 00:00:00 2001 From: Garvin Hicking Date: Thu, 22 Sep 2016 14:33:52 +0200 Subject: [PATCH] allow arrays --- include/functions.inc.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/functions.inc.php b/include/functions.inc.php index 12dc33d6..c682bde1 100644 --- a/include/functions.inc.php +++ b/include/functions.inc.php @@ -1124,7 +1124,7 @@ function serendipity_request_end() { * @param $uri string The URL to fetch * @param $method string HTTP method (GET/POST/PUT/OPTIONS...) * @param $contenttype string optional HTTP content type - * @param $contenttype string optional extra data (i.e. POST body) + * @param $contenttype mixed optional extra data (i.e. POST body), can be an array * @param $extra_options array Extra options * @param $addData string possible extra event addData declaration for 'backend_http_request' hook * @return $content string The URL contents @@ -1190,7 +1190,11 @@ function serendipity_request_url($uri, $method = 'GET', $contenttype = null, $da } if ($data != null) { - $req->setBody($data); + if (is_array($data)) { + $req->addPostParameter($data); + } else { + $req->setBody($data); + } } try {