Reputation: 21
<?php
header('Content-Type: text/html; charset=utf-8');
$html = file_get_html("http://www.stackoverflow.com/");
echo $html;
But when I want to get the source from Here! I don't correct response and I get something like these characters:
F"H�H�VDPJ����˲59��[��v���R �N��T�E"#nܸ��s��=� ��������?�?
Upvotes: 0
Views: 76
Reputation: 3070
file_get_html() is most probably used in Simple HTML DOM class. Either include that class, or better use curl to fetch the content.
If you comment the line where you have set the header, you will actually see an error notice which gets converted to the gibberish content due to the header set.
Upvotes: 1