Project

General

Profile

Bug #14916 » bug_1364_v2.diff

Administrator Admin, 2007-07-06 18:06

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;
$curlConf = array_merge($GLOBALS['TYPO3_CONF_VARS']['SYS']['curl'], $curlConf);
// (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') {
$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);
(2-2/3)