Dear list, [Sorry if this may be a bit of topic, but I don't know much about php and http, and I'm not sure where else to turn]
I'm trying to port a working php api client implementation to clojure. So on the one hand, I've got the following working php code for performing a signed post request: function perform_request($url, $method, $key, $secret) { $query_params['method'] = $method; $mt = explode(' ', microtime()); $query_params['nonce'] = $mt[1]*1000; $query_string = http_build_query($query_params, '', '&'); $sign = hash_hmac("sha512", $query_string, $secret); $headers = array( 'sign: '.$sign, 'key: '.$key, ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $res = curl_exec($ch); return $res; } On the other hand, I've got the following clojure code which, as far as I can tell, performs an identical request (I've checked that the signatures are the same in both implementations): (defn perform-request [url method key secret] (let [query-params {:method method :nonce (clj-time.coerce/to-long (clj-time.core/now))} query-string (clj-http.client/generate-query-string query-params) signature (pandect.core/sha512-hmac query-string secret)] (clj-http.client/post url {:query-params query-params :headers {"sign" signature "key" key}}))) Unfortunately, the clojure code always returns with an "unable to authorize request, check post data" response from the remote service, and I don't understand why? Is it possible that the default client settings in php/curl are different from those in clj-http or something, i.e. maybe I need to disable/add some clj-http request wrappers or something? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.