Answer the question
In order to leave comments, you need to log in
How to parse a block without a class, ID?
Book in the library's electronic catalog :
I need to parse the title proper. How to do it right?
While doing this:
require 'simple_html_dom.php';
// Создаём ДОМ из строки с хтмл-кодом Марк-вью
$html = str_get_html($htmlMarc);
// Прогоняем все <td> на странице, находим нужный
foreach($html->find('td') as $element) {
if ($a == 1) {
echo $element->plaintext;
return;
}
if ($element->plaintext == 'Основное заглавие')
$a = 1;
}
Answer the question
In order to leave comments, you need to log in
no need for left libraries, no extra searches - use xpath luke)
$doc = new DOMDocument();
@$doc->loadHTMLFile('http://catalog.mgdb.ru:49001/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=31737');
$xpath = new DOMXpath($doc);
echo $xpath->query("//tr[td='Основное заглавие']/td[2]")[0]->nodeValue;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question