1. Go to this page and download the library: Download blacktrue/sat-scraper library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
blacktrue / sat-scraper example snippets
use Blacktrue\Scraping\SATScraper;
$satScraper = new SATScraper([
'rfc' => 'XAXX010101000',
'ciec' => '123456',
'tipoDescarga' => 'recibidos',//emitidos
'cancelados' => true,//false, * todos,
//'loginUrl' => 'https://cfdiau.sat.gob.mx/nidp/app/login?id=4&sid=1&option=credential' //Opcional para sobreescribir la url del login
]);
$satScraper->downloadPeriod(2016,7,1,2016,7,1);
print_r($satScraper->getData());
use Blacktrue\Scraping\SATScraper;
use Blacktrue\Scraping\Exceptions\SATCredentialsException;
use Blacktrue\Scraping\Exceptions\SATAuthenticatedException;
try{
$satScraper = new SATScraper([
'rfc' => 'XAXX010101000',
'ciec' => '123456',
'tipoDescarga' => 'recibidos',//emitidos
'cancelados' => true,//false
]);
}catch(SATCredentialsException $e){ //Error de credenciales
echo $e->getMessage();
}catch(SATAuthenticatedException $e){ //Error en login, posible cambio en metodo de login
echo $e->getMessage();
}