PHP code example of actengage / capture

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

    

actengage / capture example snippets


composer 

php artisan vendor:publish --tag=capture-config

CAPTURE_ENDPOINT=http://localhost:3000/

use Actengage\Capture\Facades\Screenshot;

$response = Screenshot::make('https://google.com')->request();

use Actengage\Capture\Facades\Screenshot;

$response = Screenshot::make('https://google.com')
    ->call('$', 'header#nav > .logo')
    ->request();

use Actengage\Capture\DataTypes\Clip;
use Actengage\Capture\Facades\Screenshot;

$response = Screenshot::make('https://google.com')
    ->clip(new Clip(800, 600, 400, 300))
    ->request();

use Actengage\Capture\DataTypes\Encoding;
use Actengage\Capture\Facades\Screenshot;

$response = Screenshot::make('https://google.com')
    ->encoding(Encoding::Binary)
    ->request();

use Actengage\Capture\Facades\Screenshot;

$response = Screenshot::make('https://google.com')
    ->fullPage(true)
    ->request();

use Actengage\Capture\DataTypes\Encoding;
use Actengage\Capture\Facades\Screenshot;

$response = Screenshot::make('https://google.com')
    ->header('Accept-Language', 'en-US')
    ->request();

use Actengage\Capture\Facades\Screenshot;

$response = Screenshot::make('https://google.com')
    ->omitBackground(true)
    ->request();

use Actengage\Capture\Facades\Screenshot;

$response = Screenshot::make('https://google.com')
    ->quality(100)
    ->request();

use Actengage\Capture\Facades\Screenshot;

$response = Screenshot::make('https://google.com')
    ->timeout(15000)
    ->request();

use Actengage\Capture\DataTypes\Type;
use Actengage\Capture\Facades\Screenshot;

$response = Screenshot::make('https://google.com')
    ->type(Type::PNG)
    ->request();

use Actengage\Capture\DataTypes\Viewport;
use Actengage\Capture\Facades\Screenshot;

$response = Screenshot::make('https://google.com')
    ->viewport(new Viewport(1200, 800))
    ->request();

use Actengage\Capture\DataTypes\WaitUntil;
use Actengage\Capture\Facades\Screenshot;

$response = Screenshot::make('https://google.com')
    ->waitUntil([WaitUntil::Load, WaitUntil::NetworkIdle2])
    ->request();