Answer the question
In order to leave comments, you need to log in
Why doesn't it output an element from an existing array in php?
There is a code that gets the page response headers:
$ch_head = curl_init();
curl_setopt($ch_head, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch_head, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch_head, CURLOPT_CONNECTTIMEOUT, 30);
curl_setopt($ch_head, CURLOPT_TIMEOUT, 30);
curl_setopt($ch_head, CURLOPT_USERAGENT, 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36');
curl_setopt($ch_head,CURLOPT_HEADER, true);
curl_setopt($ch_head, CURLOPT_NOBODY, true);
curl_setopt($ch_head, CURLOPT_URL, 'https://web.archive.org/web/http://d0llmoto.ru/1713562.php');
$headers = curl_exec($ch_head);
curl_close($ch_head);
preg_match('/x-archive-guessed-charset: (.*)/', $headers, $encoding);
print_r($encoding);
echo $encoding[1];
Array
(
[0] => x-archive-guessed-charset: windows-1251
[1] => windows-1251
)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question