İki farklı sitede tek dosyada curl komutlarını çalıştırmam gerekiyor. Ancak bir site utf-8 diğeri ise iso-8859-9 ikisinden de aynı dosya içinde curl ile içerik çekliyor.
function curl_cek($url){
$baslig[0] = "Accept: text/xml,application/xml,application/xhtml+xml,";
$baslig[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
$baslig[] = "Cache-Control: max-age=0";
$baslig[] = "Connection: keep-alive";
$baslig[] = "Keep-Alive: 300";
$baslig[] = "Accept-Charset: ISO-8859-9,utf-8;q=0.7,*;q=0.7";
$baslig[] = "Accept-Language: en-us,en;q=0.5";
$baslig[] = "Pragma: ";
$useragent = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_REFERER, $url);
curl_setopt ($ch, CURLOPT_USERAGENT, $useragent);
curl_setopt ($ch, CURLOPT_HTTPHEADER, $baslig);
curl_setopt ($ch, CURLOPT_TIMEOUT , 30);
$rmx = curl_exec($ch);
$rmx = mb_convert_encoding ($rmx, "auto");
/*//bu şekilde de denedim yine olmadı.
$contentType = curl_getinfo($rmx, CURLINFO_CONTENT_TYPE);
if($contentType == "iso-8859-9"){
$rmx = mb_convert_encoding ($rmx, "iso-8859-9", "utf-8");
}
elseif($contentType == "utf-8"){
$rmx = mb_convert_encoding ($rmx, "utf-8", "iso-8859-9");
}
//*/
curl_close($ch);
return $rmx;
}