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 8585559
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:05:43+00:00 2026-06-11T22:05:43+00:00

Hi I am trying to scrape the UFC events schedule with Simple HTML DOM

  • 0

Hi I am trying to scrape the UFC events schedule with Simple HTML DOM Parser.

I am struggling to select the right data.

i want the Title, Image, Date, Time & Location.

So far i have tried

function scraping_ufc() {
    // create HTML DOM
    $html = file_get_html('http://uk.ufc.com/schedule/event/');

    // get news block
    foreach($html->find('table tr') as $event) {
        // get title
        $item['title'] = trim($event->find('div[class="event-tagline"]', 0)->innertext);
        // get details
        $item['date'] = trim($event->find('div[class="date"]', 0)->innertext);

        $item['time'] = trim($event->find('div[class="time"]', 0)->innertext);

        $ret[] = $item;
    }


    // clean up memory
    $html->clear();
    unset($html);

    return $ret;
}

Alot of not needed table rows are selected, i do manage to get the title but not the date or time.

Please help me select the data i need efficiently.

  • 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-11T22:05:45+00:00Added an answer on June 11, 2026 at 10:05 pm

    First of all, stop using simple html dom because it’s less reliable than the built-in dom library. It was useful some years ago but these days it really just causes more problems than it solves.

    $dom = new DOMDocument();
    @$dom->loadHTMLFile('http://uk.ufc.com/schedule/event/');
    $xpath = new DOMXPath($dom);
    

    Next, you need a better way to identify the rows you want. table tr will select every tr on the page and you don’t want that. It would be nice if the tr’s were styled but they’re not so I came up with this:

    foreach($xpath->query('//td[@class="upcoming-events-image"]/..') as $tr){
      $item['title'] = $xpath->query('.//div[@class="event-tagline"]/a', $tr)->item(0)->nodeValue;
      $item['date'] = $xpath->query('.//div[@class="date"]', $tr)->item(0)->nodeValue;
      $item['time'] = $xpath->query('.//div[@class="time"]', $tr)->item(0)->nodeValue;
      $ret[] = $item;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to scrape specific html tags including their data from a google
I'm trying to scrape an HTML page for it's title using a regular expression.
I am trying to scrape an html table and save its data in a
Trying to scrape images and data from a website using Xpath but keeps showing
I am trying to scrape some data from a web site. This is the
I'm currently trying to scrape a website that has fairly poorly-formatted HTML (often missing
I am trying to scrape some data from a page with a table based
I'm trying to scrape all the inner html from the <p> elements in a
I am learning Python - Beautiful Soup by trying to scrape data. I have
I'm trying to scrape data from an external JSON feed and store it in

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.