Exemple #1
0
 protected static function initialize_curl($url, $headers, $timeout)
 {
     $curl = curl_init($url);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($curl, CURLOPT_HEADER, true);
     if (!empty($headers)) {
         curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
     }
     if ($timeout) {
         curl_setopt($curl, CURLOPT_TIMEOUT, $timeout);
     }
     $proxy = mfwServerEnv::httpProxy();
     if ($proxy) {
         curl_setopt($curl, CURLOPT_PROXY, $proxy['host']);
         curl_setopt($curl, CURLOPT_PROXYPORT, $proxy['port']);
     }
     return $curl;
 }