php - Read a page generated with JavaScript -


this time i'm looking special. in php page, got table generated javascript, here example :

example page

this table racing game results. didn't write js, , can't change format of results. need parse these results variables, generate championship results giving points guys, adding points of multiple series, etc...

i tried :

  • parsing domdocument, substr, it's js generated can't work.

  • >>this solution<< sounded doesn't work.

do guys have idea exploitable array ? if not, suggest alternative solution ? i'm not able reproduce js in php function, hard.

here js : click thank !

here's how you'd able parse initial array in php:

$url = 'http://mxs-concept.com/liveresults/test.php'; $page = file_get_contents($url); // fetch page  preg_match('/resultslines=(.+)print_race_analysis/sim', $page, $matches); // find javascript array $js = preg_replace('/,\s+\]$/', ']', $matches[1]); // fix last comma before "]"  $array = json_decode($js); // decode array var_dump($array); // see exact array had in javascript 

however, after reading edit, seems you'd need more work if you're taking php way. might want try install nodejs , make parse js might overkill. if you, i'd translate js php if take day because nodejs might take week instead.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -