mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 14:17:49 +02:00
Support for CURL proxies.
This commit is contained in:
@@ -484,6 +484,15 @@ class e_file
|
||||
|
||||
if(vartrue($options['decode'], false)) $address = urldecode($address);
|
||||
|
||||
$urlData = parse_url($address);
|
||||
$referer = $urlData['scheme']."://".$urlData['host'];
|
||||
|
||||
if(empty($referer))
|
||||
{
|
||||
$referer = e_REQUEST_HTTP;
|
||||
}
|
||||
|
||||
|
||||
// Keep this in first position.
|
||||
if (function_exists("curl_init")) // Preferred.
|
||||
{
|
||||
@@ -493,11 +502,27 @@ class e_file
|
||||
curl_setopt($cu, CURLOPT_HEADER, 0);
|
||||
curl_setopt($cu, CURLOPT_TIMEOUT, $timeout);
|
||||
curl_setopt($cu, CURLOPT_SSL_VERIFYPEER, FALSE);
|
||||
curl_setopt($cu, CURLOPT_REFERER, e_REQUEST_HTTP);
|
||||
curl_setopt($cu, CURLOPT_REFERER, $referer);
|
||||
curl_setopt($cu, CURLOPT_FOLLOWLOCATION, 0);
|
||||
curl_setopt($cu, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
|
||||
curl_setopt($cu, CURLOPT_COOKIEFILE, e_SYSTEM.'cookies.txt');
|
||||
curl_setopt($cu, CURLOPT_COOKIEJAR, e_SYSTEM.'cookies.txt');
|
||||
|
||||
if(defined('e_CURL_PROXY'))
|
||||
{
|
||||
curl_setopt($cu, CURLOPT_PROXY, e_CURL_PROXY); // PROXY details with port
|
||||
}
|
||||
|
||||
if(defined('e_CURL_PROXYUSERPWD'))
|
||||
{
|
||||
curl_setopt($cu, CURLOPT_PROXYUSERPWD, e_CURL_PROXYUSERPWD); // Use if proxy have username and password
|
||||
}
|
||||
|
||||
if(defined('e_CURL_PROXYTYPE'))
|
||||
{
|
||||
curl_setopt($cu, CURLOPT_PROXYTYPE, e_CURL_PROXYTYPE); // If expected to cal
|
||||
}
|
||||
|
||||
if($postData !== null)
|
||||
{
|
||||
curl_setopt($cu, CURLOPT_POST, true);
|
||||
|
Reference in New Issue
Block a user