From 9c1c29ec747aaf81d4b2f6a1407588823b6e8c1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre=20Mazi=C3=A8re?= Date: Mon, 29 Aug 2016 13:50:53 +0200 Subject: [PATCH] [NasaApodBridge] code simplification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Pierre Mazière --- bridges/NasaApodBridge.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bridges/NasaApodBridge.php b/bridges/NasaApodBridge.php index c30eccfc..9b333c8e 100644 --- a/bridges/NasaApodBridge.php +++ b/bridges/NasaApodBridge.php @@ -3,12 +3,12 @@ class NasaApodBridge extends BridgeAbstract{ public $maintainer = "corenting"; public $name = "NASA APOD Bridge"; - public $uri = "http://apod.nasa.gov/apod/astropix.html"; + public $uri = "http://apod.nasa.gov/apod/"; public $description = "Returns the 3 latest NASA APOD pictures and explanations"; public function collectData(){ - $html = $this->getSimpleHTMLDOM('http://apod.nasa.gov/apod/archivepix.html') or $this->returnServerError('Error while downloading the website content'); + $html = $this->getSimpleHTMLDOM($this->uri.'archivepix.html') or $this->returnServerError('Error while downloading the website content'); $list = explode("
", $html->find('b', 0)->innertext); for($i = 0; $i < 3;$i++) @@ -17,7 +17,7 @@ class NasaApodBridge extends BridgeAbstract{ $item = array(); $uri_page = $html->find('a',$i + 3)->href; - $uri = 'http://apod.nasa.gov/apod/'.$uri_page; + $uri = $this->uri.$uri_page; $item['uri'] = $uri; $picture_html = $this->getSimpleHTMLDOM($uri);