M
M
mynewvk2017-03-09 12:28:39
PHP
mynewvk, 2017-03-09 12:28:39

How to parse a table. PHP?

There is a schedule www.lp.edu.ua/rozklad-dlya-studentiv?inst=9&group=...
just a plate, you need to somehow parse into elements by day of the week, subgroups and type of week (numerator and denominator). How to do it better? I can't think of an algorithm, I'm using phpQuery.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
F
Falseclock, 2017-03-09
@mynewvk

Save the page in the DOM and then continue as appropriate.
php.net/manual/en/class.domdocument.php
Here is an example

$rates = @file_get_contents($config['exchange_source'], false, $context);

  $dom = new DOMDocument();
  $dom->loadHTML($rates);
  
  foreach( $dom->getElementsByTagName('a') as $node)
  {
    $array[] = $node->nodeValue; 
  }
  
  $data = array(
    'USD' => array('buy' => $array[5],'sell' => $array[6]),
    'EUR' => array('buy' => $array[8],'sell' => $array[9]),
    'RUB' => array('buy' => $array[11],'sell' => $array[12]),
  );

P
Puma Thailand, 2017-12-09
@opium

Solve the problem mathematically through equations and cycles will not be needed here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question