P
P
php_xak2021-07-22 19:51:57
PHP
php_xak, 2021-07-22 19:51:57

json inside html php comment?

If you open the page, it will be empty, and if you open it through code views, then an html comment will appear in which the JSON data is located. How to read such JSON page with php?LitZNYQ2a1E.jpg?size=557x184&quality=96&sign=2aa47ddc72e2f1c2511471b450fbd502&type=album

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vitaly_74, 2021-07-22
@vitaly_74

the easiest

$string = "...html comment...";
$string  = substr($string, 0, -3);
$string = substr($string, 4);
return json_decode($string);

or you can use regular expressions to pull out the beginning and end of the comment

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question