Skip to content

🏢 (Live Link) (2022) Use PHP technologies to crawl and click buttons on websites with GUI. I highly recommend working with Linux (including virtual machines) or MacOs. Laravel 12.

License

Notifications You must be signed in to change notification settings

kkamara/php-scraper

Repository files navigation

php-scraper.gif

PhP Scraper API

(2022) Use PHP technologies to crawl and click buttons on websites with GUI. I highly recommend working with Linux (including virtual machines) or MacOs. Laravel 12.

Important note:

Before you try to scrape any website, go through its robots.txt file. You can access it via domainname/robots.txt. There, you will see a list of pages allowed and disallowed for scraping. You should not violate any terms of service of any website you scrape.

Using Postman?

Postman client.

Published Postman API Collection.

Requirements

Installation

cp .env.example .env
# Don't worry when the following step errors related to chromedriver binary, we will install them right after.
composer install

Add chromedriver to Path

Make sure Chromedriver is installed and added to your environment Path.

# install chromedriver for Panther client.
vendor/bin/bdi detect drivers
sudo mv drivers/chromedriver /usr/local/bin/chromedriver
# Or
# chromedriver_mac64
# chromedriver_win32
# See https://chromedriver.storage.googleapis.com
# for drivers list.
wget https://chromedriver.storage.googleapis.com/2.37/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
sudo mv chromedriver /usr/local/bin/chromedriver
chromedriver --version

Continue installation

composer install
php artisan key:generate
# Before running the next command:
# Update your database details in .env
php artisan migrate --seed
yarn install
yarn build

Download Selenium Server jar file

Download Selenium Server jar file.

Run the following in a new terminal.

java -jar selenium-server-4.29.0.jar standalone --override-max-sessions true --max-sessions 10

CLI options in the Selenium Grid.

Usage

Update the command at ./app/Console/Commands/BrowserScrape.php

php artisan browser:scrape

BrowserInvoker.php

Panther Environment Variables

Panther Environment Variables.

Capabilities

Capabilities.

Using Desired Capabilities.

Adding a new command

php artisan make:crawler TestCrawler

Misc

See Python Selenium web scraper.

See MRVL Desktop.

See PHP ReactJS Boilerplate.

See PHP Docker Skeleton.

See Python Docker Skeleton.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

BSD

About

🏢 (Live Link) (2022) Use PHP technologies to crawl and click buttons on websites with GUI. I highly recommend working with Linux (including virtual machines) or MacOs. Laravel 12.

Topics

Resources

License

Stars

Watchers

Forks