0

http://www.tablesleague.com/england/

How can I get the information from the league table on this website into an array using PHP?

I don't know how to isolate elements on a web page using the cURL() or file_get_contents() functions.

I'd ultimately like to store the position, wins, losses etc of each team in a multidimensional array (for each league), and then in my database, to access across my whole site.

All this information is on the website, I just need to retrieve it. Then I'd insert it into my database table, which would look like this:

team_name | position | games_played | wins | losses | draws | points | next_game | uniqueid|

An example of one array that I'd like to achieve would look something like this:

    $epl = array(
        //
        array("Arsenal", 3, 15, 8, 2, 5, 29, "Chelsea"),
        array("Chelsea", 1, 15, 12, 0, 3, 39, "Arsenal"),
        etc....
        )

?>

I am very unfamiliar with functions such as cURL and `file_get_contents(), and also unfamiliar with simple html dom parser, so as much detail as possible would be appreciated.

Thanks in advance.

What a Dave
  • 44
  • 2
  • 12
  • 1
    possible duplicate of [Extract data from web page, and put it into database using PHP?](http://stackoverflow.com/questions/24566380/extract-data-from-web-page-and-put-it-into-database-using-php) – Dave Chen Jul 08 '14 at 07:21
  • No, I changed the contents of that question. Sorry about that. – What a Dave Jul 08 '14 at 07:24
  • You might want to double check that scraping the page is not against the sites terms of use. Otherwise, you will want to use curl to download the page and then see [How do you parse and process HTML/XML in PHP?](http://stackoverflow.com/questions/3577641/how-do-you-parse-and-process-html-xml-in-php) – Paul Blundell Jul 08 '14 at 07:50
  • You can use `cURL` and `file_get_contents()` only to download page - you can't use it to get elements from page. You need other librares. – furas Jul 10 '14 at 12:17

0 Answers0