PHP code example of shaarli / netscape-bookmark-parser
1. Go to this page and download the library: Download shaarli/netscape-bookmark-parser 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/ */
shaarli / netscape-bookmark-parser example snippets
// parse.php
apeBookmarkParser\NetscapeBookmarkParser;
$parser = new NetscapeBookmarkParser();
$bookmarks = $parser->parseFile('./tests/Fixtures/Encoder/input/netscape_basic.htm');
var_dump($bookmarks);
// export.php
peBookmarkParser\NetscapeBookmarkParser;
$data = [
[
'name' => 'shaarli/Shaarli',
'url' => 'https://github.com/shaarli/Shaarli',
'image' => 'data:image/png;base64, ...'
'description' => 'The personal, minimalist, super-fast, database free, bookmarking service',
'public' => true,
'tags' => ['shaarli'],
],
[
'name' => 'shaarli/netscape-bookmark-parser',
'url' => 'https://github.com/shaarli/netscape-bookmark-parser',
'public' => false,
'dateCreated' => '1612572000',
'dateModified' => '1612572000',
'tags' => ['shaarli'],
],
];
$parser = new NetscapeBookmarkParser();
$parser->export($data, './export.htm');
xml
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><p>
<DT><H3>shaarli</H3>
<DL><p>
<DT><A HREF="https://github.com/shaarli/Shaarli" PRIVATE="0" ICON="data:image/png;base64, ...">shaarli/Shaarli</A>
<DD>The personal, minimalist, super-fast, database free, bookmarking service
<DT><A HREF="https://github.com/shaarli/netscape-bookmark-parser"> ADD_DATE="1612572000" LAST_MODIFIED="1612572000">shaarli/netscape-bookmark-parser</A>
<\DL><p>
<\DL><p>