Use all param of getURLContent

This commit is contained in:
Laurent Destailleur 2021-04-07 23:31:16 +02:00
parent 1e1b963ca7
commit 6c4f5b851d
2 changed files with 2 additions and 1 deletions

View File

@ -158,7 +158,7 @@ if (GETPOST('target') == 'local') {
} }
} }
if (GETPOST('target') == 'remote') { if (GETPOST('target') == 'remote') {
$xmlarray = getURLContent($xmlremote); $xmlarray = getURLContent($xmlremote, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only
// Return array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...) // Return array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') { if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') {

View File

@ -190,6 +190,7 @@ function getURLContent($url, $postorget = 'GET', $param = '', $followlocation =
$info = curl_getinfo($ch); // Reading of request must be done after sending request $info = curl_getinfo($ch); // Reading of request must be done after sending request
$http_code = $info['http_code']; $http_code = $info['http_code'];
if ($followlocation && ($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307)) { if ($followlocation && ($http_code == 301 || $http_code == 302 || $http_code == 303 || $http_code == 307)) {
$newUrl = $info['redirect_url']; $newUrl = $info['redirect_url'];
$maxRedirection--; $maxRedirection--;