example :
<script>
var TEST = { "contextData" :
{id:01,title:one},{id:02,title:two},{id:03,title:three}}
</script>
how to get all title ? using PHP Simple HTML DOM Parser, I just have no idea to do this.
The following is not tested but should work:
$script = $html->find('script', 0);
preg_match_all
as suggested by @pguardiario, to get the titles value: /title\\s*:\\s*([^}]+)/
EDIT:
And to get all titles and desc (different of qwerty) modify the pattern to: /(title|desc)\\s*:\\s*(?!qwerty)([^},]+)/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.