PHP code example of capturely / capturely-laravel
1. Go to this page and download the library: Download capturely/capturely-laravel 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/ */
capturely / capturely-laravel example snippets
'capturely' => [
'token' => env('CAPTURELY_TOKEN', 'INSERT_TOKEN'),
],
use Capturely\Capturely;
// Returns Response with URL & File Size
$capture = Capturely::url('https://google.com')->screenshot()->capture();
echo $capture->url;
// OR Stream Response
$capture = Capturely::url('https://google.com')->pdf()->stream();
return $capture;
use Capturely\Capturely;
use Capturely\Structures\Screenshot;
$capture = Capturely::url('https://google.com')
->screenshot(function(Screenshot $screenshot) {
return $screenshot
->fullPage()
->png()
->base64();
})
->capture();
echo $capture->url;
use Capturely\Capturely;
use Capturely\Structures\Pdf;
use Capturely\Structures\Viewport;
$capture = Capturely::url('https://google.com')
->pdf(function(Pdf $pdf) {
return $pdf->letter();
})
->viewport(function(Viewport $viewport){
return $viewport
->windowSize(800,600)
->isLandscape();
})
->extraHttpHeaders([
'Custom-Header-Name' => 'secret',
])
->authentication('user', 'pass')
->userAgent('My Custom User Agent')
->emulateMediaType('print')
->toS3('my-bucket', 'path')
->capture();
echo $capture->url;