Project

General

Profile

Bug #14916 » bug_1364_v3.diff

Administrator Admin, 2007-07-06 18:25

View differences:

t3lib/class.t3lib_div.php (Arbeitskopie)
* @param string Filepath/URL to read
* @param integer Whether the HTTP header should be fetched or not. 0=disable, 1=fetch header+content, 2=fetch header only
* @param array HTTP headers to be used in the request
* @param array Additional cURL options
* @return string The content from the resource given as input.
*/
function getURL($url, $includeHeader = 0, $requestHeaders = false) {
function getURL($url, $includeHeader=0, $requestHeaders=false, $curlConf=array()) {
$content = false;
// (Proxy support implemented by Arco <arco@appeltaart.mine.nu>)
if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlUse'] == '1' && preg_match('/^https?:\/\//', $url)) {
if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlUse']=='1') {
$curlConf_global = t3lib_div::trimExplode(chr(10),$GLOBALS['TYPO3_CONF_VARS']['SYS']['curl']);
$curlConf = array_merge($curlConf_global, $curlConf);
$proto = substr($url, 0, strpos($url,'://'));
$openWithCurl = ($proto!='' && t3lib_div::inList('ftp,ftps,http,https,gopher,telnet', strtolower($proto)));
} else $openWithCurl = false;
if ($openWithCurl) {
// External URL without error checking.
$ch = curl_init();
if (!$ch) {
......
curl_setopt($ch, CURLOPT_HTTPHEADER, $requestHeaders);
}
// Proxy support implemented by Arco <arco@appeltaart.mine.nu>
if ($GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']) {
curl_setopt($ch, CURLOPT_PROXY, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyServer']);
......
curl_setopt($ch, CURLOPT_PROXYUSERPWD, $GLOBALS['TYPO3_CONF_VARS']['SYS']['curlProxyUserPass']);
}
}
foreach ($curlConf as $opt=>$value) {
curl_setopt($ch, $opt, $value);
}
$content = curl_exec($ch);
curl_close($ch);
(3-3/3)