1

file_get_contents return strange symbols instead website content

Code echo file_get_contents('https://olbi.su');

Output:

��}y�Ǒ��$��lcwf쮾��]�X[�--`��������8�U����)%�2�my����:?<�"Ekx ���_a?ɋ_d�G���(-�ə��#22"22223j�ܳ/>�ҿ��s�/���[g7��x$F�9�,�SŞ�Dϰ7K#�. �S]U�,�o6.��]�uu��V+�...

Vv.
  • 89
  • 9
  • 3
    Possible duplicate of [file\_get\_contents() Breaks Up UTF-8 Characters](https://stackoverflow.com/questions/2236668/file-get-contents-breaks-up-utf-8-characters) and [file_get_contents converts utf 8 to iso 8859 1](https://stackoverflow.com/questions/5600371/file-get-contents-converts-utf-8-to-iso-8859-1) and [file_get_contents show characters of utf 8 like question marks](https://stackoverflow.com/questions/39290627/file-get-contents-show-characters-of-utf-8-like-question-marks) – Cid May 15 '19 at 14:46

1 Answers1

2
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, 'https://olbi.su');
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_ENCODING , 'gzip');
$content = curl_exec ($ch);

print_r($content);

This will show you the whole page like you expect. Use curl library so you can apply encoding.

pr1nc3
  • 8,108
  • 3
  • 23
  • 36