无法使用file_get_html获取确切的字符集

时间:2012-10-04 18:12:47

标签: php ajax simple-html-dom

我正在尝试使用简单的html dom的file_get_html从网站获取详细信息。我尝试过的链接是:http://dns.marnet.net.mk/registar.php?dom=test.mk

我得到的是充满问号

������ ������������ ������: 
test.com.mk
test.mk
�������� �� �������: test.mk [ ����� ��:15507 ]
���� �� ���� � ������� ��������������: 24-02-2013
���� �� ������������ �� �������:

24-02-2009
����� ��� �� ������������:

��� ��������� �������-������ ����� ������, ������� �� �����������, ���������, �������� � ������
������ �� ������������:

���. ����� �������� ��. 15/10, ������
��� �� ������������:

4030006605991
�������� �� ������������:

02/3114-001

��������������� �������
���:

����� ���������
e-mail:

zivko@prologistics.com
�������:

02/3114-000
�������� �������
���:

����� ���������
e-mail:

boris@proinformatics.com
�������:

02/3114-002
������� �����������
���
IP
ns2.powweb.com  65.254.254.134
ns1.powweb.com  65.254.254.135

如何获取网站中使用的原始字符?

2 个答案:

答案 0 :(得分:2)

我找到了解决方案。

我在file_get_html命令之后添加了这个。

$html=mb_convert_encoding($html,'utf8','windows-1251');

根据需要转换了我的字符集。

感谢所有回复的人。

答案 1 :(得分:0)

我在查看源代码时检查了页面上的字符集: 它给了我这个:

<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">