Skip to content

Commit

Permalink
Convert parameters array to string before passing to CURL (#35)
Browse files Browse the repository at this point in the history
Convert parameters array to url-encoded string before passing to CURL, to avoid the case when parameters is a multi-dimension array
  • Loading branch information
tridungpham authored and dzungtran committed May 12, 2017
1 parent 16b0068 commit 5e2962d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/Paymentwall/HttpAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5e2962d

Please sign in to comment.