PHP code example of doklibs / browserless-sdk

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

    

doklibs / browserless-sdk example snippets


$url = "https://google.com";
$servers = [new \DokLibs\Browserless\Host('http://localhost:6130/')];
$browserless = new \DokLibs\Browserless\Client($servers);
echo $browserless->content($url, new \DokLibs\Browserless\Options\DisableJavascript)->getBody()->getContents());

$browserless->pdf($url, null, './google.pdf');

$browserless->download('http://clean.kins.re.kr/common/fileDownload.jsp?IS_NSIC=Y&RPT_SEQ=27&FILE_NAME=%ED%95%B4%EC%96%91%EB%B0%A9%EC%82%AC%EB%8A%A5%EC%A1%B0%EC%82%AC(2006).pdf&PATH_NAME=report'
    , 'https://nsic.nssc.go.kr/dta/actvInfoList.do?divUpperCd=CMN01705'
    , 'file.pdf'); 

$url = "https://google.com";
$servers = [new \DokLibs\Browserless\Host('http://localhost:6130/')];
$browserless = new \DokLibs\Browserless\Client($servers);
$request = $browserless->makeRequest($url, []);

$option = (new \DokLibs\Browserless\Options\ScreenShot)->merge(
            new \DokLibs\Browserless\Options\DisableGaAndAds()
        );
$browserless->screenshot($url, $option, './123dok.jpg');