From 9048f6815e9ab5acdaeb5883065d53d9a14f6b35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B0=D0=B4=D0=B8=D0=BC?= Date: Mon, 15 May 2017 19:55:10 +0300 Subject: [PATCH] shortener response parsing --- GoogleUrlShortener.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/GoogleUrlShortener.php b/GoogleUrlShortener.php index 1ee5308..bd1de6a 100644 --- a/GoogleUrlShortener.php +++ b/GoogleUrlShortener.php @@ -12,7 +12,6 @@ class GoogleUrlShortener extends Component function init() { parent::init(); - $this->apiEndpoint .= $this->apiKey !== null ? '?key=' . $this->apiKey . '&' : ''; } /** @@ -40,6 +39,8 @@ public function shorten($longUrl) 'longUrl' => $longUrl ]); - return $request->content; + $response = $request->send(); + + return $response->data['id']; } } \ No newline at end of file