PHP code example of nelson / puppeteer

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

    

nelson / puppeteer example snippets

 php
$html = '<body style="color: #fff; background: rebeccapurple"><h1>Puppeteer test</h1><p>Some text paragraph</p>';
$html .= '<p>' . date(DateTime::ISO8601) . '</p>';
$html .= '</body>';

/** @var Generator $generator */
$generator = $this->generatorFactory->create();
$output = $generator->generateFromHtml($html, Generator::GENERATE_BOTH);
 php
$output = $generator->generateFromUrl(new UrlScript('https://www.google.com'), Generator::GENERATE_BOTH);