Fix SSF by replacing curl with getURLContent()

This commit is contained in:
Laurent Destailleur 2020-11-09 11:20:23 +01:00
parent 5d5bbb2b5e
commit 2d29bd39e4

View File

@ -628,17 +628,18 @@ class MultiCurrency extends CommonObject
{ {
global $conf, $db, $langs; global $conf, $db, $langs;
include_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
$urlendpoint = 'http://apilayer.net/api/live?access_key='.$key; $urlendpoint = 'http://apilayer.net/api/live?access_key='.$key;
//$urlendpoint.='&format=1'; //$urlendpoint.='&format=1';
$urlendpoint .= (empty($conf->global->MULTICURRENCY_APP_SOURCE) ? '' : '&source='.$conf->global->MULTICURRENCY_APP_SOURCE); $urlendpoint .= (empty($conf->global->MULTICURRENCY_APP_SOURCE) ? '' : '&source='.$conf->global->MULTICURRENCY_APP_SOURCE);
dol_syslog("Call url endpoint ".$urlendpoint); dol_syslog("Call url endpoint ".$urlendpoint);
// FIXME Use getURLContent() function instead. $resget = getURLContent($urlendpoint, 'GET', '', 1, array(), array('http', 'https'), 1);
$ch = curl_init($urlendpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); if ($resget['content']) {
$response = curl_exec($ch); $response = $resget['content'];
curl_close($ch);
$response = json_decode($response); $response = json_decode($response);
if ($response->success) if ($response->success)
@ -670,6 +671,7 @@ class MultiCurrency extends CommonObject
return -1; return -1;
} }
} }
}
/** /**
* Check in database if the current code already exists * Check in database if the current code already exists