Saving scraped data to a database (Intermediate)

In all of the recipes so far, the results of our scrapes are simply been printed to the screen. While this is fine for small projects, where the data may only be required only one time; but if we are scraping a large amount of data, which needs to be organized and saved for future access, we will need to create a database.

Getting ready

In this recipe, we will create a database using MySQL, into which we can save our scraped data. We will then modify the previous recipe, which prints the scraped data to the screen, to access the database, and save the data.

How to do it...

  1. Start the XAMPP Control Panel.
  2. Click on the Admin button for MySQL, and phpMyAdmin will open in our web browser.
  3. Select the Users ...

Get Instant PHP Web Scraping now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.