From 6161ad1bd3ad407a9723eed70ee00d4e1152c54b Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Wed, 19 Sep 2018 11:09:27 +0200 Subject: [PATCH] make CURLOPT_FOLLOWLOCATION optional in HttpClient::urlGet Signed-off-by: Michael Kaufmann --- lib/classes/cURL/class.HttpClient.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/classes/cURL/class.HttpClient.php b/lib/classes/cURL/class.HttpClient.php index 53a52114..6953624a 100644 --- a/lib/classes/cURL/class.HttpClient.php +++ b/lib/classes/cURL/class.HttpClient.php @@ -10,13 +10,15 @@ class HttpClient * * @return array */ - public static function urlGet($url) + public static function urlGet($url, $follow_location = true) { include FROXLOR_INSTALL_DIR . '/lib/version.inc.php'; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, 'Froxlor/' . $version); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + if ($follow_location) { + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); + } curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $output = curl_exec($ch); if ($output === false) {