PHP code example of adibaba / delicious-export

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

    

adibaba / delicious-export example snippets


      $parser = new Adibaba\DeliciousExport\HtmlParser('delicious.html');
    $parser->parse();
    
    $generator = new Adibaba\DeliciousExport\Generator();
    $generator->setHtmlParser($parser);
    file_put_contents('bookmarks.html', $generator->generate());
    

     $parser = new Adibaba\DeliciousExport\HtmlParser('delicious.html');
    file_put_contents('bookmarks.json', json_encode($parser->parse()->getBookmarks()));
    

     $parser = new Adibaba\DeliciousExport\HtmlParser('delicious.html');
    $parser->setSplitTags(true);
    file_put_contents('bookmarks.json', json_encode($parser->parse()->getBookmarks()));
    

      $parser = new Adibaba\DeliciousExport\HtmlParser('delicious.html');
    $parser->parse();
    
    $generator = new Adibaba\DeliciousExport\Generator();
    $generator->setHtmlParser($parser)
    
    // Templates
    ->setTemplateMain('./templateMain.htm')
    ->setTemplateTag('<li><a href="#_TAG_">_TAG_<span>_TAG_SIZE_</span></a></li>', false)
    ->setTemplateCollection('<h1 id="_TAG_">_TAG_</h1><ul>_BOOKMARKS_</ul>', false)
    ->setTemplateBookmark('./templateBookmark.htm')
    ->setTemplateBookmarkNote('<pre>_BOOKMARK_NOTE_</pre>', false)
    ->setTemplateBookmarkTag('<span><a href="#_BOOKMARK_TAG_">_BOOKMARK_TAG_</a></span>', false)
    
    // Default tag for bookmarks without specified tag
    ->setDefaultNoTags('No-Tags')
    
    // Specifies, if bookmark notes/descriptions are added
    ->setIncludeNotes(true)
    
    // Specifies, if only public bookmarks should be 

     $parser = new Adibaba\DeliciousExport\HtmlParser('delicious.html');
    $parser->parse();
    
    // Bookmarks
    print_r($parser->getBookmarks());
    
    // Tags, sorted by name
    print_r($parser->getTags());
    
    // Tags, sorted by size
    print_r($parser->getTags(true));
    
    // Bookmarks without tags
    print_r($parser->getBookmarkIdsWithoutTags());