From 5e2962d9335fa4aacca65bb46027e5d94b8415bc Mon Sep 17 00:00:00 2001 From: Pham Tri Dung Date: Fri, 12 May 2017 18:42:39 +0700 Subject: [PATCH] Convert parameters array to string before passing to CURL (#35) Convert parameters array to url-encoded string before passing to CURL, to avoid the case when parameters is a multi-dimension array --- lib/Paymentwall/HttpAction.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/Paymentwall/HttpAction.php b/lib/Paymentwall/HttpAction.php index dd820d2..5e0daf5 100644 --- a/lib/Paymentwall/HttpAction.php +++ b/lib/Paymentwall/HttpAction.php @@ -83,15 +83,15 @@ protected function request($httpVerb = '', $url = '', $params = array(), $custom } if (!empty($params)) { - curl_setopt($curl, CURLOPT_POSTFIELDS, $params); + curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($params)); + } + + // CURL_SSLVERSION_TLSv1_2 is defined in libcurl version 7.34 or later + // but unless PHP has been compiled with the correct libcurl headers it + // won't be defined in your PHP instance. PHP > 5.5.19 or > 5.6.3 + if (! defined('CURL_SSLVERSION_TLSv1_2')) { + define('CURL_SSLVERSION_TLSv1_2', 6); } - - // CURL_SSLVERSION_TLSv1_2 is defined in libcurl version 7.34 or later - // but unless PHP has been compiled with the correct libcurl headers it - // won't be defined in your PHP instance. PHP > 5.5.19 or > 5.6.3 - if (! defined('CURL_SSLVERSION_TLSv1_2')) { - define('CURL_SSLVERSION_TLSv1_2', 6); - } curl_setopt($curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $httpVerb);