How to get json in the html?

<!DOCTYPE html>
<html lang="en-us">
the <head>
the <title>Text</title>
</head>
the <body>
 <div class="pane" role="main" onclick="void(0)">
 <div id="text" class="container tooltip-hide"></div>
</div>
<script type="text/javascript">
Classify("cs.services/GlobalObject").set({
 pageContext: "",
 countryCode: "us",
 langCode: "en",
 errorMsg: ""
});
 Classify("cs.services/GlobalObject").set("userObj", 'null');
 Classify("cs.services/GlobalObject").set("countryLangLinks", '{"code":"us","languages":[{"code":"en","label":"English","selected":true},{"code":"es","label":"EspaƱol","selected":false}],"action":"/us/en/country","label":" United States"}');
</script>

the <script>
 Classify("cs.services/GlobalObject").set("responseJson",{"DISPUTE_MESSAGE":"Test","results":[{"resultText":"LALALA."},{"resultText":"TEXT HERE"},{"resultText":"123"}],"STATUS":"OK","REG":"Y", "Info":{"text":"123","text2":"3","image":"url","id":"12345"}});
Classify("cs.services/GlobalObject").set("responseJson.LINK_URL","/us/en/");
Classify("cs.services/GlobalObject").set("callerId","ccweb");
</script>
</body>
</html>


The task is to pull this json:
{"DISPUTE_MESSAGE":"Test","results":[{"resultText":"LALALA."},{"resultText":"TEXT HERE"},{"resultText":"123"}],"STATUS":"OK","REG":"Y", "Info":{"text":"123","text2":"3","image":"url","id":"12345"}}
April 3rd 20 at 17:40
3 answers
April 3rd 20 at 17:42
Solution
@Charles.Stood, thank you for your interest in my question, however, receive the json parts:
5df289ea174d7440099079.png

You can make the same regular expression to get the fully json 1? Ideally, to make a reference to "responseJson" - Wilson.Dani commented on April 3rd 20 at 17:45
@Wilson.Dani, https://regex101.com/r/psuy23/2 - Charles.Sanfor commented on April 3rd 20 at 17:48
@Charles.Stood, not really, but I figured it out myself how to alter this expression and now everything works fine. thank you ;) - Wilson.Dani commented on April 3rd 20 at 17:51
April 3rd 20 at 17:44
Learn https://www.php.net/manual/ru/class.domdocument.php
After get the innerText of the desired element <script>.
And then or some JParser, or Regular expressions.
@mac.Yost immediately brewing question, if using simple_html_dom we do this:
$html->find('script'8)

If 8 script exists then OK, but if the server gave a result with 13 different scripts, then we will receive not what we wish... ? but if the 8th does not exist - catch the error. There are more correct decisions in such cases? - Wilson.Dani commented on April 3rd 20 at 17:47
April 3rd 20 at 17:46
Make a regex for a unique substring DISPUTE_MESSAGE and pit it on the HTML page (not the DOM!).
Use preg_match() to get the desired matches of a substring in the REGEX expression.

Find more questions by tags PHP