w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to get text inside javascript tag using PHP Simple HTML DOM Parser

The following is not tested but should work:

  • Get the script using $script = $html->find('script', 0);
  • Use the following pattern, with preg_match_all as suggested by @pguardiario, to get the titles value: /titles*:s*([^}]+)/



And to get all titles and desc (different of qwerty) modify the pattern to: /(title|desc)s*:s*(?!qwerty)([^},]+)/


© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.