PHP code example of winteruni / google-doc-scraper

1. Go to this page and download the library: Download winteruni/google-doc-scraper 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/ */

    

winteruni / google-doc-scraper example snippets


// If you are using it in custom project with composer autoload, you need to use WinterUni\GoogleDoc\Scraper\Html as HtmlScraper;
use WinterUni\GoogleDoc\Validator\Html as HtmlValidator;
use WinterUni\GoogleDoc\Filter\Body as BodyFilter;

// This content can be obtained when saving google docs file
$content = file_get_contents('./docs/1/10.html');

$document = new Document($content, new HtmlScraper(new HtmlValidator(), new BodyFilter()));

$title = $document->getTitle();
$body = $document->getBody();
$customStyle = $document->getCustomStyle();

echo $title;
echo $body;
echo $customStyle;