Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

141
Visualizações
Get all HTML list element using Simple HTML Dom

Currently I am working on a project which requires me to parse some data from an alternative website, and I'm having some issues (note I am very new to PHP coding.)

Here's the code I am using below + the content it returns.

$dl = $html2->find('ol.tracklist',0);
print $dl = $dl->outertext;

The above code returns the data for what we're trying to get, it's below but extremely messy provided you would like to see click here.

However, when I put this in a foreach, it only returns one of the a href attributes at a time.

foreach($html2->find('ol.tracklist') as $li) 
{
    $title = $li->find('a',0);
    print $title;
}

What can I do so that it returns all of the a href elements from the example code above?

NOTE: I am using simple_html_dom.php for this.

about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Based on the markup, just point directly to it, just get it list then point to its anchor:

foreach ($html2->find('ol.tracklist li') as $li) {
    $anchor = $li->find('ul li a', 0);
    echo $anchor->href; // and other attributes
}
about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda