$v ) { $headerArr[] = $n .':' . $v; } $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($ch, CURLOPT_HTTPHEADER, $headerArr); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $temp = curl_exec($ch); if(@file_put_contents($file, $temp) && !curl_error($ch)) { return $file; } else { throw new ResultInfoException(curl_error($ch),"POST_ERROR"); } } else { $params = array( "http"=>array( "method"=>"GET", "header"=>"User-Agent:windows", "timeout"=>$timeout) ); $context = stream_context_create($params); if(@copy($url, $file, $context)) { //$http_response_header return $file; } else { return false; } } } }