Answer the question
In order to leave comments, you need to log in
How to parse specific column from html table?
There is a table:
https://jsfiddle.net/zghmnt17/
Please push, how can I output to an array of a specific column?
Array(
[8:30-10:00] => "Языки программирования..."
[10:10-11:40] => "Мат логика"
...
)
error_reporting(E_ALL);
ini_set('allow_url_fopen','1');
include_once('simple_html_dom.php');
$html = file_get_html('http://kpfu.ru/week_sheadule_print?p_group_name=09-533');
foreach($html->find('table tr td') as $e){
$arr[] = trim($e->innertext);
}
print_r($arr);
Answer the question
In order to leave comments, you need to log in
foreach($html->find('table tr td') as $e){
Your selector does not correspond to the task at hand, it should either look something like this:
or, like this:
where 3 is the index of the element in the set, relative to the parent (starts from zero, if my memory serves me right).
I can’t say exactly how to write correctly within the framework of php_simple_html_dom (I last used phpQuery and then DomCrawler (from Symfony)), but the main point is that you must find / use an analogue of the eq filter from JQuery.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question