1

I tried to get the site information http://www.tsetmc.com/Loader.aspx?ParTree=15 with the command file_get_contents. But my output is meaningless?

Output results are as follows

�\�-]���[sי�{?U�z������A9;Nƻ�W�/{�R)HB$b��e9I�XJ������ŶF��D�����%�yW�8w7A�����ի�z�{>\����N��a]��4��F�ݭ��F�Yߪ^�q���޽\�._����/����\<�����K�q����t�X��3����������ꥰ��ݝN㰷�q��}�n���v������W�^o��������K�vv[V�׭�v�;��+�

Used command:

<?php

$data = file_get_contents('http://www.tsetmc.com/Loader.aspx?ParTree=15');

echo $data;

?>
Ali
  • 13
  • 4

1 Answers1

0

You can use the curl with gzip option:

Example:

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'http://www.tsetmc.com/Loader.aspx?ParTree=15');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_ENCODING, 'gzip');
$data = curl_exec($ch);