📚 PHP Mini-Course: Creating a Web Scraping
Jagaad Academy
🏢 Published by:This mini-course present how to create a web scraping from scratch using PHP. Even those who are not familiar with PHP but understand basic programming concepts will be able to reproduce the steps shown in this mini-course. And, with a little more time, you can use the techniques presented to create your PHP script.
Content
The mini-course starts by presenting how to set up the environment (on Windows). Then, it goes through understanding Web Crawler and Web Scraping, PHP basics concepts overview, and creating a simple script to collect data from websites. Finally, we'll improve the created code using more advanced PHP techniques.
Note: During the mini-course, there are some jumps between basics and intermediate PHP concepts to see a little more about the language features.
Tools
Tools installed at the beginning of the mini-course:
- XAMPP: It provides the PHP executable
- Composer: The PHP package manager. Its installer provides the environment variable configuration also for PHP
- Git Bash (Windows): It provides a terminal (Unix-like) containing the Git command
Commands
The main commands used during the mini-course:
pwd
: Show the current directory pathmkdir jagaad.academy
: Create the directoryjagaad.academy
cd jagaad.academy
: Change the directory to the passed one, in this casejagaad.academy
mkdir php-basics
: Create the directoryphp-basics
cd php-basics
: Change the directory to the passed one, in this casephp-basics
clear
: Clear the visible commands in the terminal
Check out the Basic UNIX commands by Stanford to learn more.
Source code
You can find in this repository the code created in the mini-course:
PHP References
Links for the main contents presented during the mini-course:
- Variable by reference
- Arrays
- Loops
- Functions
- Classes
- DOMDocument
- DOMXPath
- Generators
- Package: Goutte PHP Web Scraper
Check out the PHP complete documentation containing more details about each of the functionalities.