From: vincent@cubedesigners.com Date: Wed, 29 Jan 2020 15:18:20 +0000 (+0000) Subject: wip #3378 @0:15 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=66bcfbea06cd346cad30c8c30bc2c75825c89a1e;p=cubeextranet.git wip #3378 @0:15 --- 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; }