curl

 

function down_url($url)

{

	$ch = curl_init ($url);

//	$fp = fopen ($saveFile, "w");

//	curl_setopt ($ch, CURLOPT_FILE, $fp);

	curl_setopt($ch, CURLOPT_ENCODING, 'gzip,deflate');
//	curl_setopt($ch, CURLOPT_REFERER, 'http://xiaonei.com');

	curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); //设定是否显示头信息 

	curl_setopt($ch, CURLOPT_USERAGENT, 

 

___FCKpd___0
SERVER['HTTP_USER_AGENT']); // curl_setopt ($ch, CURLOPT_HEADER, true); //设定是否输出页面内容 curl_setopt ($ch, CURLOPT_HEADER, false); //设定是否输出页面内容 curl_setopt($ch, CURLOPT_TIMEOUT, 5); $html = curl_exec($ch); // execute the curl command curl_close ($ch); return $html; // fclose ($fp); }

你可能感兴趣的:(curl)