From 25290c2a7b5ad0cf50abb3bedfa52eda31079ed3 Mon Sep 17 00:00:00 2001 From: LDAV Date: Mon, 6 Nov 2023 08:42:21 +0100 Subject: [PATCH] Update spid-php.tpl get previously saved file if registry.spid.gov.it has problems --- setup/sdk/spid-php.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup/sdk/spid-php.tpl b/setup/sdk/spid-php.tpl index d8da90c..b670e36 100644 --- a/setup/sdk/spid-php.tpl +++ b/setup/sdk/spid-php.tpl @@ -376,13 +376,13 @@ public function addSPIDButtonListItems($method='GET'): string { $method = strtolower($method); - $registry_idp_json = file_get_contents('https://registry.spid.gov.it/entities-idp?output=json'); + $registry_idp_json = @file_get_contents('https://registry.spid.gov.it/entities-idp?output=json'); $registry_idp = json_decode($registry_idp_json, true); if($registry_idp!=null && is_array($registry_idp) && count($registry_idp)) { - file_put_contents('spid-idps.json', $registry_idp_json); + file_put_contents(__DIR__ . 'spid-idps.json', $registry_idp_json); } else { - $registry_idp = json_decode(file_get_contents('spid-idps.json'), true); + $registry_idp = json_decode(file_get_contents(__DIR__ . 'spid-idps.json'), true); } if($method=='post') {