public static function curlInit() { if (!empty(self::$handle)) { curl_close(self::$handle); } self::$user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US)' . ' AppleWebKit/532.0 (KHTML, like Gecko)' . ' Chrome/3.0.195.32 Safari/532.0'; self::$max_redirects = 5; self::$connect_timeout = 0.5; self::$handle = curl_init(); curl_setopt(self::$handle, CURLOPT_USERAGENT, self::$user_agent); curl_setopt(self::$handle, CURLOPT_CONNECTTIMEOUT, self::$connect_timeout); curl_setopt(self::$handle, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt(self::$handle, CURLOPT_AUTOREFERER, TRUE); curl_setopt(self::$handle, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt(self::$handle, CURLOPT_FILETIME, TRUE); curl_setopt(self::$handle, CURLOPT_MAXREDIRS, self::$max_redirects); curl_setopt(self::$handle, CURLOPT_HTTPHEADER, array('Expect:')); curl_setopt(self::$handle, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt(self::$handle, CURLOPT_HEADER, TRUE); curl_setopt(self::$handle, CURLOPT_NOBODY, FALSE); }