chemax, чето нифига не понял???
если страница страница в утф то чембы ты не получал курлом либо через гетконтент она в утф и получит, а мне нужно к единому стандарту привести.
через заголовок вот так сделал
PHP |
function CurlPage($path, $post, $proxy) {
$agent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1.1.4322)"; $ch = curl_init ( $path ); @curl_setopt ( $ch , CURLOPT_USERAGENT , $agent ); @curl_setopt ( $ch , CURLOPT_HEADER , 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); curl_setopt($ch, CURLOPT_TIMEOUT, 20); curl_setopt($ch,CURLOPT_ENCODING,"gzip,deflate"); curl_setopt($ch, CURLOPT_REFERER, "");
if($post!='') { curl_setopt($ch, CURLOPT_POST,1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); }
if($proxy!='') { curl_setopt ( $ch , CURLOPT_PROXY, $proxy); }
$tmp = @curl_exec ( $ch );
if ( preg_match ("/charset\s*=[\"']?(.*)[\"']?\b/i",$tmp,$temp)){ $charset_heder = trim ($temp[1]); if(strtoupper($charset_heder) != "UTF-8"){ $tmp = iconv(strtoupper($charset_heder),"UTF-8",$tmp); } }
unset($temp);
return $tmp; } |
а по другому распознать кодировку не получится???
гдето видел функция была