Simple Machines Community Forum

Customizing SMF => SMF Coding Discussion => Topic started by: Atomixx on March 19, 2017, 05:57:09 PM

Title: Copying an html table from another website
Post by: Atomixx 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?
Title: Re: Copying an html table from another website
Post by: Arantor 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.
Title: Re: Copying an html table from another website
Post by: Atomixx on March 19, 2017, 07:46:10 PM
Quote from: Arantor 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.

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.
Title: Re: Copying an html table from another website
Post by: Colin 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.