Skip to content

elbrashdy/tra-crawler

 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%