/** * Constructor * * @author Atul Atri */ public function __construct() { parent::__construct(); $_SWIFT = SWIFT::GetInstance(); $_maxConnect = SWIFT_ConfigManager::Get('REQ_MAX_CONNECT'); $_connectTimeout = SWIFT_ConfigManager::Get('REQ_CONNECT_TIMEOUT'); $_timeout = $_SWIFT->Settings->Get('bc_req_timeout'); $_contentType = SWIFT_ConfigManager::Get('REQ_CONTENT_TYPE'); $_redirection = SWIFT_ConfigManager::Get('REQ_FOLLOW_LOCATION'); $_bcAppName = $_SWIFT->Settings->Get('bc_app_name'); $_bcAppEmail = $_SWIFT->Settings->Get('bc_email'); $_userAgent = ""; if (!empty($_bcAppName) && filter_var($_bcAppEmail, FILTER_VALIDATE_EMAIL)) { $_userAgent = "{$_bcAppName} ({$_bcAppEmail})"; } $this->_defaultReqOpts = array(CURLOPT_MAXCONNECTS => $_maxConnect, CURLOPT_CONNECTTIMEOUT => $_connectTimeout, CURLOPT_TIMEOUT => $_timeout, CURLOPT_FOLLOWLOCATION => $_redirection); if ($_userAgent) { $this->_defaultReqOpts[CURLOPT_USERAGENT] = $_userAgent; } $_shouldDebug = SWIFT_ConfigManager::get('DEBUG_CURL'); if ($_shouldDebug) { $_debug_file = SWIFT_ConfigManager::Get('DEBUG_CURL_FILE'); $_fp = @fopen($_debug_file, "a"); $this->_defaultReqOpts[CURLOPT_VERBOSE] = true; $this->_defaultReqOpts[CURLOPT_STDERR] = $_fp; } $this->_defaultReqHeaders['Content-Type'] = $_contentType; }