PHP code example of edcs / grabby

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

    

edcs / grabby example snippets




use Edcs\Grabby\Factory;

ww.google.co.uk');

$grabby->grab();



use Edcs\Grabby\Factory;

ww.google.co.uk', 'screenshot.png', '/my/storage/dir/', [
    'viewportSize' => [
        'width' => 150,
        'height' => 200
    ]
]);

$grabby->grab();



use Edcs\Grabby\Factory;

ww.google.co.uk', 'screenshot.pdf', '/my/storage/dir/', [
    'paperSize' => [
        'format' => 'A4',
        'orientation' => 'portrait',
        'margin' => '1cm'
    ]
]);

$grabby->grab();



use Edcs\Grabby\Factory;

ww.google.co.uk', 'screenshot.pdf', '/my/storage/dir/', [
    'customHeaders' => [
        'X-Test' => 'foo'
    ],
    'viewportSize' => [
        'width' => 150,
        'height' => 200
    ],
    'paperSize' => [
        'format' => 'A4',
        'orientation' => 'portrait',
        'margin' => '3cm'
    ]
]);

$grabby->grab();



use Edcs\Grabby\Factory;

ww.google.co.uk', 'screenshot.png', '/my/storage/dir/', 150, 200);

$file = $grabby->grab()->getScreengrabLocation(); // Returns /my/storage/dir/screenshot.png



use Edcs\Grabby\Factory;

ww.google.co.uk', 'screenshot.png', '/my/storage/dir/', 150, 200);

$fileContents = $grabby->grab()->getScreengrab(); // Returns the contents of /my/storage/dir/screenshot.png