diff -r 12fc4e8b6fde -r bb7808e180c3 Utils/WikiTagUtils.php --- a/Utils/WikiTagUtils.php Mon Feb 20 12:09:41 2012 +0100 +++ b/Utils/WikiTagUtils.php Thu Feb 23 18:52:59 2012 +0100 @@ -200,9 +200,25 @@ $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - //TODO: change - curl_setopt($ch, CURLOPT_USERAGENT, 'http://www.iri.centrepompidou.fr'); + // default values + curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:10.0.1) Gecko/20100101 Firefox/10.0.1'); curl_setopt($ch, CURLOPT_TIMEOUT_MS, 5000); + // Set options if they are set in the config.yml file, typically for proxy configuration. + // Thanks to the configuration file, it will execute commands like "curl_setopt($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);" or "curl_setopt($ch, CURLOPT_PROXY, "xxx.yyy.zzz:PORT");" + $curl_options = $GLOBALS["kernel"]->getContainer()->getParameter("wiki_tag.curl_options"); + foreach ($curl_options as $key => $value) { + if(strtoupper($value)=='TRUE'){ + $value = TRUE; + } + else if (strtoupper($value)=='FALSE'){ + $value = FALSE; + } + else if (defined($value)){ + $value = constant($value); + } + curl_setopt($ch, constant($key), $value); + } + // end of treatment $res = curl_exec($ch); $curl_errno = curl_errno($ch); $curl_error = curl_error($ch);