PHP Classes

Bookmarks Checker for Chrome and Firefox: Check browser bookmark files to identify dead URLs

Recommend this page to a friend!
  Info   View files Example   View files View files (9)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 119 All time: 9,508 This week: 455Up
Version License PHP version Categories
bookmarks-checker 1.0.0GNU General Publi...5HTTP, PHP 5, Files and Folders, Valid...


This package can check browser bookmark files to identify dead URLs.

It can take a file with bookmarks used by the Chrome or Firefox browsers and checks if the URL they point are still accessible.

The package can determine the number of links that are still accessible or it failed to access them.

Innovation Award
PHP Programming Innovation award nominee
April 2019
Number 9
Many users take advantage of the bookmark system provided in most browsers to remember important pages that they want to access frequently or remember to access later when they have more time.

However, over time certain pages are removed or become inaccessible for same reason.

This package helps finding URLs in bookmarks files used by browsers like Chrome and Firefox, thus helping to clean bookmarks of pages that are no longer available.

Manuel Lemos
Picture of Martin Latter
  Performance   Level  
Name: Martin Latter <contact>
Classes: 8 packages by
Country: United Kingdom
Age: ???
All time rank: 130260 in United Kingdom
Week rank: 311 Up13 in United Kingdom Up
Innovation award
Innovation award
Nominee: 5x


The best PHP chrome bookmarks import to MySQL database class
Export bookmarks to HTML, parse the HTML, and import into MySQL


#!/usr/bin/env php

    * Bookmarks Checker
    * Verify links in a Chrome or Firefox exported bookmarks file using cURL multi.
    * Usage: php bookmarks_checker.php [file]
    * @author Martin Latter
    * @copyright Martin Latter 15/01/2019
    * @version 0.08
    * @license GNU GPL version 3.0 (GPL v3);
    * @link



define('DUB_EOL', PHP_EOL . PHP_EOL);
define('DEFAULT_FILE', 'bookmarks.html');
define('LOG_FILE', 'bookmarks_checker.log');
define('BATCH_SIZE', 200); # size of each cURL request batch

/* filename */
if ( ! isset($_SERVER['argv'][1]))
    if (
$sFilename = DEFAULT_FILE;
$sUsage =
PHP_EOL . ' ' .
str_replace('_', ' ', ucwords(basename(__FILE__, '.php'), '_')) .
"\tusage: " . basename(__FILE__) . ' [filename]' .

$sFilename = $_SERVER['argv'][1];

/* no such file */
if ( ! file_exists($sFilename))
PHP_EOL . ' ' . $sFilename . ' does not exist in this directory!' . DUB_EOL);

$sHtml = file_get_contents($sFilename);

$rxPattern = '/<a\s[^>]*href=\"([^\"]*)\"[^>]*>(.*)<\/a>/siU'; /* avoid attributes: by */

preg_match_all($rxPattern, $sHtml, $aMatches, PREG_SET_ORDER);

$aLinks = [];

foreach (
$aMatches as $aLinkEntity)
$aLinks[] = [ 'url' => $aLinkEntity[1], 'name' => $aLinkEntity[2] ];

if (empty(
' No links extracted from ' . $sFilename . DUB_EOL);

PHP_EOL . ' ' . count($aLinks) . ' links being checked ...' . DUB_EOL;

$oChecker = new URLChecker2($aLinks);

PHP_EOL . ' ' . $oChecker->getURLFails() . ' links failed';
PHP_EOL . ' ' . ($oChecker->getURLTotal() - $oChecker->getURLFails()) . ' links verified' . DUB_EOL;


Bookmarks Checker

Identify dead links in Firefox and Chrome bookmarks.


So many browser bookmarks &ndash; there are 1,900 URLs in my bookmarks. And in just one year, 120 of those URLs ceased to exist.

A simple PHP prototype script provided a slow way (~1 URL per second) of checking for dead links.

I switched to Python to leverage its threading capabilities and speed up the process. Then I finally got round to adding cURL multi to the PHP script.


$ php bookmarks_checker.php

1883 links being checked ...

error | | 0 | 4.999007 | nxytimes

See generated logfile bookmarks_checker.log
URL parse time: 177.642 s

95 links failed
1788 links verified


  • Python 3
  • Python 2
  • PHP and cURL


Export browser bookmarks.

The scripts by default will attempt to load a file in the same directory called bookmarks.html An alternative filename can be specified on the command-line.

The scripts parse the file and try to access each URL, printing a list of URLs that cannot be accessed (which will intermittently include a false positive).




(or make the file executable and run directly e.g. ./


-h or --help displays help text.

-f <file> allows an alternatively-named file to be loaded instead of the default bookmarks.html


    php bookmarks_checker.php [file]

Exporting Browser Bookmarks <a id="export"></a>


Bookmarks > Show All Bookmarks > Import and Backup > Export Bookmarks to HTML


Access Chrome's Bookmark Manager with:

<kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>O</kbd>



then click Organize > Export bookmarks to HTML file ...


Python Scripts

Setting DEBUG = True will show all URLs as access is attempted, and either the successful response or the failure error message.


Doug Hellmann, jfs, and philshem for threading pools in Python.


Scripts are released under the GPL v.3.

  Files folder image Files  
File Role Description
Files folder imageclasses (1 file)
Accessible without login HTML file bookmarks.html Doc. Documentation
Accessible without login Plain text file bookmarks_checker.php Example Example script
Accessible without login Plain text file Data Auxiliary data
Accessible without login Plain text file bookmarks_checker_prototype.php Aux. Auxiliary script
Accessible without login Plain text file Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Doc. Documentation
Accessible without login Plain text file speed_example.txt Doc. Documentation

  Files folder image Files  /  classes  
File Role Description
  Plain text file url_checker.class.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,508
This week:455Up