Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 1 addition & 37 deletions src/SimpleEmailServiceRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,29 +77,6 @@ public function setParameter($key, $value, $replace = true) {
return $this;
}

/**
* Get the params for the request
*
* @return array $params
*/
public function getParametersEncoded() {
$params = array();

foreach ($this->parameters as $var => $value) {
if(is_array($value)) {
foreach($value as $v) {
$params[] = $var.'='.$this->__customUrlEncode($v);
}
} else {
$params[] = $var.'='.$this->__customUrlEncode($value);
}
}

sort($params, SORT_STRING);

return $params;
}

/**
* Clear the request parameters
* @return SimpleEmailServiceRequest $this
Expand Down Expand Up @@ -146,7 +123,7 @@ protected function getCurlHandler() {
public function getResponse() {

$url = 'https://'.$this->ses->getHost().'/';
$query = implode('&', $this->getParametersEncoded());
$query = http_build_query($this->parameters, '', '&', PHP_QUERY_RFC3986);
$headers = $this->getHeaders($query);

$curl_handler = $this->getCurlHandler();
Expand Down Expand Up @@ -263,19 +240,6 @@ private function __responseWriteCallback($curl, $data) {
return strlen($data);
}

/**
* Contributed by afx114
* URL encode the parameters as per http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?Query_QueryAuth.html
* PHP's rawurlencode() follows RFC 1738, not RFC 3986 as required by Amazon. The only difference is the tilde (~), so convert it back after rawurlencode
* See: http://www.morganney.com/blog/API/AWS-Product-Advertising-API-Requires-a-Signed-Request.php
*
* @param string $var String to encode
* @return string
*/
private function __customUrlEncode($var) {
return str_replace('%7E', '~', rawurlencode($var));
}

/**
* Generate the auth string using Hmac-SHA256
*
Expand Down