PHP code example of phpcfdi / opinion-cumplimiento-sat-scraper

1. Go to this page and download the library: Download phpcfdi/opinion-cumplimiento-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/ */

    

phpcfdi / opinion-cumplimiento-sat-scraper example snippets




use GuzzleHttp\Client;
use GuzzleHttp\Cookie\CookieJar;
use GuzzleHttp\RequestOptions;
use PhpCfdi\ImageCaptchaResolver\Resolvers\ConsoleResolver;
use PhpCfdi\OpinionCumplimientoSatScraper\Scraper;

$cookieJar = new CookieJar();

$client = new Client([
    'cookies' => $cookieJar,
    'curl' => [
        CURLOPT_SSL_CIPHER_LIST => 'DEFAULT@SECLEVEL=1',
    ],
    RequestOptions::VERIFY => false,
]);

$captchaSolver = new ConsoleResolver();

$scraper = new Scraper(
    $client,
    $captchaSolver,
    'TU_RFC',
    'TU_CIEC'
);

$content = $scraper->download();
file_put_contents('opinion.pdf', (string) $content);