探索者

function G_copy($url,$file_name) {
	$ch = curl_init($url);
	$fp = fopen($file_name, "wb");
	$user_agent = 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727;';
	$url_info = parse_url($url);
	$host = $url_info['host'];
	$header = array(
	'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
	'Accept-Charset: UTF-8,*',
	'Accept-Encoding: gzip, deflate',
	'Accept-Language: en-us,en;q=0.5',
	'Connection: keep-alive',
	"Host: {$host}",
	"User-Agent: {$user_agent}",
	);
	$options = array(CURLOPT_FILE => $fp,
	CURLOPT_HEADER => 0,
	CURLOPT_FOLLOWLOCATION => 1,
	CURLOPT_TIMEOUT => 240,
	CURLOPT_HTTPHEADER => $header,
	);
	curl_setopt_array($ch, $options);
	$ret = curl_exec($ch);
	if (!$ret){
	var_export(curl_error($ch));
	}
	curl_close($ch); 
	fclose($fp);
	return $ret;
}


京ICP备12040723号 关于易寻 联系我们 手机版