public function getShares($url) { $data = json_decode(file_get_contents(sprintf(self::API_URL, urlencode($url))), true); return isset($data['result']['views']) ? intval($data['result']['views']) : 0; }