Beispiel #1
0
function _curl_options()
{
    $opt = array(CURLOPT_HEADER => 1, CURLOPT_TIMEOUT => 15, CURLOPT_RETURNTRANSFER => 1, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_USERAGENT => Config::get('ua') ? Config::get('ua') : _user_agents());
    if (Config::get('proxy')) {
        $opt[CURLOPT_PROXY] = Config::get('proxy');
        // To do supply proxy auth information.
    }
    return $opt;
}
 function file_hash()
 {
     // set user agent for md5_file, avoid to get ban
     if (function_exists('_user_agents')) {
         ini_set('user_agent', _user_agents());
     }
     $data = json_decode(file_get_contents(ROOT_PATH . '/base/data/wp-version.json'), true);
     foreach ($data as $file => $hash) {
         if (($md5 = @md5_file($this->url . '/' . $file)) != false) {
             if (array_key_exists($md5, $hash)) {
                 return $hash[$md5];
             }
         }
     }
     return false;
 }