diff --git a/src/Bing/Client.php b/src/Bing/Client.php index 7ad8f05..9da6979 100644 --- a/src/Bing/Client.php +++ b/src/Bing/Client.php @@ -26,12 +26,17 @@ public function __construct($api_key, $output = 'json') public function get($endpoint, $params = array()) { - $qs = "?\$format={$this->output}"; - if ($params['Query']) { - $params['Query'] = "'{$params['Query']}'"; - } - $qs .= ($params) ? '&'.http_build_query($params) : ''; + try { + $qs = "?\$format={$this->output}"; + if ($params['Query']) { + $params['Query'] = "'{$params['Query']}'"; + } + $qs .= ($params) ? '&'.http_build_query($params) : ''; - return file_get_contents($this->base_uri.'/'.$endpoint.$qs, 0, $this->context); + return file_get_contents($this->base_uri.'/'.$endpoint.$qs, 0, $this->context); + } catch(Exception $e) { + echo $e->getMessage(); + exit; + } } }