Skip to content

Commit 4d09f5d

Browse files
committed
update v4 and endpoints
1 parent 4869678 commit 4d09f5d

File tree

1 file changed

+2
-34
lines changed

1 file changed

+2
-34
lines changed

src/SimpleEmailServiceRequest.php

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -77,28 +77,7 @@ public function setParameter($key, $value, $replace = true) {
7777
return $this;
7878
}
7979

80-
/**
81-
* Get the params for the request
82-
*
83-
* @return array $params
84-
*/
85-
public function getParametersEncoded() {
86-
$params = array();
87-
88-
foreach ($this->parameters as $var => $value) {
89-
if(is_array($value)) {
90-
foreach($value as $v) {
91-
$params[] = $var.'='.$this->__customUrlEncode($v);
92-
}
93-
} else {
94-
$params[] = $var.'='.$this->__customUrlEncode($value);
95-
}
96-
}
97-
98-
sort($params, SORT_STRING);
9980

100-
return $params;
101-
}
10281

10382
/**
10483
* Clear the request parameters
@@ -146,7 +125,7 @@ protected function getCurlHandler() {
146125
public function getResponse() {
147126

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

152131
$curl_handler = $this->getCurlHandler();
@@ -264,18 +243,7 @@ private function __responseWriteCallback($curl, &$data) {
264243
return strlen($data);
265244
}
266245

267-
/**
268-
* Contributed by afx114
269-
* URL encode the parameters as per http://docs.amazonwebservices.com/AWSECommerceService/latest/DG/index.html?Query_QueryAuth.html
270-
* 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
271-
* See: http://www.morganney.com/blog/API/AWS-Product-Advertising-API-Requires-a-Signed-Request.php
272-
*
273-
* @param string $var String to encode
274-
* @return string
275-
*/
276-
private function __customUrlEncode($var) {
277-
return str_replace('%7E', '~', rawurlencode($var));
278-
}
246+
279247

280248
/**
281249
* Generate the auth string using Hmac-SHA256

0 commit comments

Comments
 (0)