From 46873e14fe6b53c22ecd6b1711229bf66090bc5e Mon Sep 17 00:00:00 2001 From: Joseph Date: Wed, 16 Oct 2019 19:44:28 +0000 Subject: [PATCH] [GoogleSearchBridge] Use getURI() to build URLs (#1330) * [GoogleSearchBridge] Use getURI() to build URLs --- bridges/GoogleSearchBridge.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/bridges/GoogleSearchBridge.php b/bridges/GoogleSearchBridge.php index c3d9561f..88f26e8c 100644 --- a/bridges/GoogleSearchBridge.php +++ b/bridges/GoogleSearchBridge.php @@ -25,10 +25,7 @@ class GoogleSearchBridge extends BridgeAbstract { public function collectData(){ $html = ''; - $html = getSimpleHTMLDOM(self::URI - . 'search?q=' - . urlencode($this->getInput('q')) - . '&num=100&complete=0&tbs=qdr:y,sbd:1') + $html = getSimpleHTMLDOM($this->getURI()) or returnServerError('No results for this query.'); $emIsRes = $html->find('div[id=ires]', 0); @@ -54,6 +51,17 @@ class GoogleSearchBridge extends BridgeAbstract { } } + public function getURI() { + if (!is_null($this->getInput('q'))) { + return self::URI + . 'search?q=' + . urlencode($this->getInput('q')) + . '&num=100&complete=0&tbs=qdr:y,sbd:1'; + } + + return parent::getURI(); + } + public function getName(){ if(!is_null($this->getInput('q'))) { return $this->getInput('q') . ' - Google search';