Skip to content

Latest commit

 

History

History
85 lines (53 loc) · 1.8 KB

README.md

File metadata and controls

85 lines (53 loc) · 1.8 KB

Logo

TRA Crawler

A PHP package for crawling TRA EFD receipts and returning its data as a collection, array or json.

Installation

Install TRA crawler with composer.

  composer require ronnie/tra-crawler

The project also make use of puppeteer to access JS content on the receipt.

  npm install puppeteer

Authors

Run Locally

Clone the project

  git clone https://github.com/RonnieTaz/tra-crawler

Go to the project directory

  cd tra-crawler

Install NPM dependencies

  npm install puppeteer

Install Composer dependencies

  composer install

Create an index.php file at the root of the project and add the following codes:

    <?php

    use Ronnie\TRA\Crawler;

    require_once __DIR__ . '/vendor/autoload.php';

    $url = $_GET['url'] ?? null;
    $code = $_GET['code'] ?? null;
    $time = $_GET['time'] ?? null;

    $crawler = new Crawler();

    if (!is_null($url)) {
        dump($crawler->setUri($url)->crawl());
    } elseif (!is_null($code) && !is_null($time)) {
        dump($crawler->setCode($code, $time)->crawl());
    } else {
        echo "No url given";
    }

Feel free to change the file according to your needs. Then just run the index.php in a web server.

Contributing

Contributions are always welcome!

See contributing.md for ways to get started.

Please adhere to this project's code of conduct.