diff --git a/src/Mailjet/php-mailjet-v3-simple.class.php b/src/Mailjet/php-mailjet-v3-simple.class.php index 976f6b1..8e362e5 100644 --- a/src/Mailjet/php-mailjet-v3-simple.class.php +++ b/src/Mailjet/php-mailjet-v3-simple.class.php @@ -251,7 +251,7 @@ public function requestUrlBuilder($resource, $params = array(), $request, $id) if ($resource == "sendEmail") { $this->call_url = $this->apiUrl."/send/message"; } - else if ($resource == "send") { + else if ($resource == "send") { $this->call_url = $this->apiUrl."/send"; //json support for SendAPI } else if ($resource == "uploadCSVContactslistData") { @@ -278,7 +278,7 @@ public function requestUrlBuilder($resource, $params = array(), $request, $id) } else if (in_array($resource, self::$_templateResources)) { - $this->call_url = $this->makeUrlFromFilter('REST', 'template', $params['ID'], $resource); + $this->call_url = $this->makeUrlFromFilter('REST', 'template', $params['ID'], $resource); } else if (in_array($resource, self::$_contactResources)) { @@ -407,8 +407,15 @@ public function sendRequest($resource = false, $params = array(), $request = "GE unset($params['ID']); } - // 64 => unescaped_slashes - curl_setopt($curl_handle, CURLOPT_POSTFIELDS, json_encode($params, 64)); + $j_e = null; + if (version_compare(phpversion(), '5.4.0', '<')) { + $j_e = str_replace('\\/', '/', json_encode($params)); + } else { + // 64 => unescaped_slashes + $j_e = json_encode($params, 64); + } + + curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $j_e); curl_setopt($curl_handle, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json' ));