From dfb39b8f15dbfcc223951bfcac72bfba671c682c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Mon, 28 Jan 2013 18:51:02 +0100 Subject: [PATCH] [-] Core: Fix Tools::file_get_contents for post and curl --- classes/Tools.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/classes/Tools.php b/classes/Tools.php index 3f8788106..9dd4f367d 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -1289,6 +1289,16 @@ class ToolsCore curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, $curl_timeout); curl_setopt($curl, CURLOPT_TIMEOUT, $curl_timeout); + $opts = stream_context_get_options($stream_context); + if (isset($opts['http']['method']) && Tools::strtolower($opts['http']['method']) == 'post') + { + curl_setopt($curl, CURLOPT_POST, true); + if (isset($opts['http']['content'])) + { + parse_str($opts['http']['content'], $datas); + curl_setopt($curl, CURLOPT_POSTFIELDS, $datas); + } + } $content = curl_exec($curl); curl_close($curl); return $content;