php - How to get element with multiple class names? -


i'm having trouble retrieving nodevalue of specific li-tag 4 class names. class name "b-programm_ended" uniquely identifies it.

<?php     $dom = new domdocument;     $dom->loadhtmlfile('https://tv.mail.ru/channel/1296/65/');     $xpath = new domxpath($dom);     $classname = 'b-programm js-schedule_item js-remind_prnt b-programm_ended';     $results = $xpath->query('//*[@class="'.$classname.'"]');     echo $now = $results->item(0)->nodevalue; ?> 

this not real issue.

unfortunately, aren't ever going able find elements class b-programm_ended. looked @ source of https://tv.mail.ru/channel/1296/65/ , not find b-programm_ended strings. however, inspected dom chrome , did find instances of b-programm_ended. means class attributes being created jquery, server-side php parsing not find tags.

however, when inspect xhr requests same site, there json data being pulled

https://tv.mail.ru/ext/admtv/?sch.favorite_event=1&sch.recommended_main=1&cfg.get=1&sch.main=1&sch.channel=1296

that contains data may looking for, instance:

schedule: [{stop: "2015-04-26 05:15:00", name: "Белохвостые гиганты "Тэкомати"", genre_id: "142",…},…]     0: {stop: "2015-04-26 05:15:00", name: "Белохвостые гиганты "Тэкомати"", genre_id: "142",…}     episode_num: "6"     episode_title: "402-я серия"     genre_id: "142"     id: "36239842"     name: "Белохвостые гиганты "Тэкомати""     start: "2015-04-26 04:50:00"     stop: "2015-04-26 05:15:00"     year: "2013"     ... 

my suggestion use json parser (json_decode in php) , conveniently pick out information looking data structure.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -