From 66bcfbea06cd346cad30c8c30bc2c75825c89a1e Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Wed, 29 Jan 2020 15:18:20 +0000 Subject: [PATCH] wip #3378 @0:15 --- inc/ws/Controlleur/class.ws.services.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/inc/ws/Controlleur/class.ws.services.php b/inc/ws/Controlleur/class.ws.services.php index 39433a23c..8f116fe83 100644 --- a/inc/ws/Controlleur/class.ws.services.php +++ b/inc/ws/Controlleur/class.ws.services.php @@ -1337,11 +1337,24 @@ class wsServices extends cubeFlashGateway { $this->outputXML = false; + $limit = time() - (3600 * 24 * 2); + $cache = WS_CACHE . '/pinterest/' . sha1($this->args['url']); header('Content-type: application/rss+xml'); - $url = 'https://www.pinterest.com/' . urlencode($this->args['url']); + ob_end_clean(); + if (file_exists($cache) && filemtime($cache) > $limit) { + echo file_get_contents($cache); + exit; + } + + $url = 'https://www.pinterest.com/' . urlencode($this->args['url']); $c = file_get_contents($url); - echo $c; + if($c) { + file_put_contents($c, $cache); + echo $c; + }else{ + echo file_get_contents($cache); + } exit; } -- 2.39.5