몇 일 전부터 다른 사이트의 예제 콘텐츠를 내 사이트로로드하기 위해 몇 가지 코드를 구현하려고합니다. 인코딩 - 폴란드어 언어에 문제가 있습니다. 원본 사이트는 ISO-8859-2이며 대상은 UTF-8입니다. Chrome, Safari에서 작동하며 FF, Opera 및 IE에서 작동하지 않습니다. 내가 도대체 뭘 잘못하고있는 겁니까?file_get_contents 인코딩 - Chrome, Safari 작동 Firefox, Opera, IE 작동하지 않음
index.php를
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test_site</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.js"></script>
<script type="text/javascript">
$("document").ready(function() {
$("#content").load("curl.php #news_ajax");
});
</script>
</head>
<body>
<h1>Test site</h1>
<div id="content"><img src="ajax-loader.gif" alt="Loading..." /></div>
</body>
</html>
curl.php는
<?php
$url = 'http://www.dominikanie.pl/';
$htm = file_get_contents($url);
$domain = "http://www.dominikanie.pl/";
$htm = preg_replace("/(href|src)\=\"([^(http)])(\/)?/", "$1=\"$domain$2", $htm);
$htm = mb_convert_encoding($htm, "ISO-8859-2",
mb_detect_encoding($htm, "UTF-8, ISO-8859-2", true));
echo $htm;
?>
나는의 iconv하지만 결과를 시도했다. 테스트 site