I need to extract a json that is inside a page, more precisely in div inside the tag data-react-props
<div data-react-class="GamePageHeader" data-react-props="{"id":1274,"slug":[...]}
How can I extract the json inside the react props? I believe that with HtmlDomParser I can't do this.
Edit:
Thanks to Prateek's reply I wrote the code:
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\CssSelector\CssSelectorConverter;
$html = file_get_html('https://www.igdb.com/games/simcity--2');
$crawler = new Crawler($html);
$data = $crawler->filter('div[data-react-class="GamePageHeader"]')->attr('data-react-props');
print $data;
But I always get the error
LOG.error: Expecting a DOMNodeList or DOMNode instance, an array, a string, or null, but got "simple_html_dom".
I have installed packages symfony/css-selector
and symfony/dom-crawler
in Laravel 5.8