From 354b13c314973259ca7710842f83ae2f7ecac09f Mon Sep 17 00:00:00 2001 From: Benjamin Lazarecki Date: Mon, 31 Mar 2014 12:59:47 +0200 Subject: [PATCH] [Bug] Fix curl post opts error. Passing an array to CURLOPT_POSTFIELDS will encode the data as multipart/form-data, while passing a URL-encoded string will encode the data as application/x-www-form-urlencoded. --- src/Widop/GoogleAnalytics/Client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Widop/GoogleAnalytics/Client.php b/src/Widop/GoogleAnalytics/Client.php index fcb961c..3d32d70 100644 --- a/src/Widop/GoogleAnalytics/Client.php +++ b/src/Widop/GoogleAnalytics/Client.php @@ -177,7 +177,7 @@ public function getAccessToken() 'assertion' => $this->generateJsonWebToken(), ); - $response = json_decode($this->httpAdapter->postContent($this->url, $headers, $content)); + $response = json_decode($this->httpAdapter->postContent($this->url, $headers, http_build_query($content))); if (isset($response->error)) { throw GoogleAnalyticsException::invalidAccessToken($response->error);