Advertisement:

Author Topic: Copying an html table from another website  (Read 874 times)

Offline Atomixx

  • Semi-Newbie
  • *
  • Posts: 21
Copying an html table from another website
« on: March 19, 2017, 05:57:09 PM »
Hello! On my forum, I need to import an html table from a different website with a live update. Any ideas?

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 67,434
    • Arantor on GitHub
Re: Copying an html table from another website
« Reply #1 on: March 19, 2017, 06:33:57 PM »
That largely depends on the other website and if they have an API or not, or whether you have to do it the hard way and hope they never ever change the structure of their page.
To assume is to hope that those who came before had the presence of mind and capacity to implement the dreams of those who would come after.

You either die a hero or live long enough to see yourself become the villain. It seems you have chosen which, and now I must do the same.

Offline Atomixx

  • Semi-Newbie
  • *
  • Posts: 21
Re: Copying an html table from another website
« Reply #2 on: March 19, 2017, 07:46:10 PM »
That largely depends on the other website and if they have an API or not, or whether you have to do it the hard way and hope they never ever change the structure of their page.

I know this may sound stupid, but what if I own the site? See, I use the second site because of a wordpress plugin that allows me to manage a league with statistics/standings etc. I don't know enough about coding to code my own league management mod so I just use the wordpress one. Other than that, I don't really need the wordpress site. So it would be more convenient to just put the standings table and statistics onto the forum.  The structure of the website won't be changing at all, only the data within the table will.

Offline Colin

  • Lead Developer
  • SMF Hero
  • *
  • Posts: 7,686
  • Gender: Male
  • SMF Developer
    • colinschoen on GitHub
Re: Copying an html table from another website
« Reply #3 on: March 19, 2017, 11:03:45 PM »
You can either create an API that will serve the data from site1 (your wordpress league site) or you can build a scraper which makes the HTTP request loads the page, and knows exactly where to look for the content that you want to access. The former is preferable.
"If everybody is thinking alike, then somebody is not thinking." - Gen. George S. Patton Jr.

Colin