Below is my PHP code and I am facing the issue of
Warning: Trying to access array offset on the value of type null in index.php on line 21
Code:
$curl = curl_init();
$url="url";
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => array(
"Accept: */*",
"Accept-Encoding: gzip, deflate, br",
"Accept-Language: en-US,en;q=0.9",
"Cookie: num=8888888; stb_lang=en; timezone=GMT",
" Host: url.com",
"User-Agent: Mozilla/5.0 (QtEmbedded; U; Linux; C) AppleWebKit/533.3 (KHTML, like Gecko) MAG200 stbapp ver: 2 rev: 250 Safari/533.3",
"Authorization: Bearer D0CF5357F55F39F7D3A1B907D13C7B16",
),
));
$response = curl_exec($curl);
curl_close($curl);
$zx = json_decode($response, true);
$xxc= $zx["js"]["cmd"];
$regex = '/\b(http?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i';
preg_match_all($regex, $xxc, $matches);
$urls = $matches[0];
// go over all links
foreach($urls as $url) {
header("Location: $url");
}
?>
Before it was working but suddenly i don't know what happened no response now and getting issue.
Can anyone please help me by solving the issue?
Just remove this line
It causes the response to be coded with gzip, deflate or brotli (br), but you have to decode the response itself.
If you prefer to NOT remove the compression, then modify like this
Last option is to leave all as you write and simply modify a little piece of code to have this:
Maybe with other compression alghoritms this doesn't work fine, so I suggest you to use the SECOND solution I propose.
"Why suddenly stop working?"
Maybe the host (bluesky.panel.tm) has changed the Api (or the server) to compress the answers?