Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8757911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:24:54+00:00 2026-06-13T14:24:54+00:00

I am using SIMPLE HTML DOM to scrape a website and I’m getting the

  • 0

I am using SIMPLE HTML DOM to scrape a website and I’m getting the following code…

$GameSummary

<dl class="ismSummary ismHomeSummary">
    <dt>Goals scored</dt>
    <dd><a class="ismViewProfile" href="#438">Gallas</a></dd>
    <dd><a class="ismViewProfile" href="#458">Defoe</a></dd>
    <dt>Assists</dt>
    <dd><a class="ismViewProfile" href="#443">Vertonghen</a></dd>
    <dd><a class="ismViewProfile" href="#447">Lennon</a></dd>
    <dt>Yellow cards</dt>
    <dd><a class="ismViewProfile" href="#438">Gallas</a></dd>
    <dd><a class="ismViewProfile" href="#439">Walker</a></dd>
    <dd><a class="ismViewProfile" href="#450">Huddlestone</a></dd>
    <dt>Saves</dt>
    <dd><a class="ismViewProfile" href="#433">Friedel</a> (3)</dd>
</dl>

I am trying to cut each section to its specific sections… I am trying to get the following info in the following order…

Heading1: Goals Scored
  Entry: Gallas
  Entry: Defoe
Heading2: Assists
  Entry: Vertongen
  Entry: Lennon
etc....

Here’s the code I can get the headers with…

foreach ($GameSummary->find('dt') as $HeadingType)
  {
  echo $HeadingType;
  }

Gives me all headings… and to get content of each header..

foreach ($GameSummary->find('dd') as $PlayerNames)
  {
  echo $PlayerNames;
  }

What I am wondering is… How do I separate these into different groups? I can get all the headers and all the content separately, but I don’t know how to get it so that each header contains its contents.

Any ideas how? It should be easy enough but my brain can’t figure it out.

Thanks!

EXAMPLE AT: http://fantasypl.com/results.php

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T14:24:56+00:00Added an answer on June 13, 2026 at 2:24 pm

    Should be, roughly:

       $i=1;
       foreach ($GameSummary->find('dl')->children() as $element)
        {
           if ($element->tag == "dt")  { echo "Heading$i: $element"; $i++; }
           if ($element->tag == "dd") echo "Entry: $element";
    
        }
    

    [EDIT] Actual working code, from the comment below:

        foreach ($GameSummary->children() as $test) 
         { 
    
            if ($test->tag == "dt") { echo "Heading$i: ".$test->innertext."<br>"; $i++;} 
            if ($test->tag == "dd") { echo "Player: ".$test->innertext."<br>";} 
          }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using simple html dom parser to scrape a website ... How can
I'm using simple-html-dom to try and pull some code from another site. Here's some
i have this html code. Im using Simple HTML Dom to parse the data
I'm using 'Simple HTML Dom' to scrape the HN Front Page (news.ycombinator.com), which works
How to isolate specific hyperlinks from a website(using simple html dom php). for example
I'm using simple html DOM and extracting two links from website. function get_links($website) {
I'm using Simple HTML DOM to scrape (with permission) some websites. I basically scrape
I'm using simple-html-dom to scrape the title off of a specified site. <?php include('simple_html_dom.php');
I'm using Simple HTML Dom . I'm trying to run the following: (with WAMP)
I am using simple html dom for parsing an external url and getting images

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.