Introduction
Visitor is a very simple link checker script. One file, no dependencies, and old school procedural style.
It is a "proof of concept" project, and many functionalities were written from scratch, like http transport and cookie management.
The purpose of Visitor is to help quality control when developing websites. A link checker will detect 404s and bad urls across pages of a website, hopefully before the final user will do.
Urls are collected by parsing the html response returned from the server: this means Visitor won't be very useful for websites in which a lot of content is generated by Javascript on the client.
Installation
Visitor is just a php script, so to run it type:
php visitor.php
Alternatively Visitor is shipped with the visitor
script, which needs to be made executable to be run.
chmod +x visitor ./visitor
or, better:
chmod +x visitor ln -s "$(pwd)/visitor" /usr/bin/visitor visitor
Usage
visitor [--help -f -t -u --project --no-cookies --cookiejar] <url> --help: Print this message. -f: String to output whenever Visitor "visits" a new url. Available variables: %url, %code, %content_type, %parent, %headers:<header_name_lowercase> -t: Sets time limit, in seconds. -t: Sets depth limit. -u: Authentication credentials, <user>:<pass> --no-cookies: Tell Visitor not to store nor send cookies. --cookiejar: Path of the json file where all cookies found will be serialized to. This option will not work if "--no-cookies" flag is on. --project: Read url and options from <CWD>/visitor.json file.
Project file
The "project file" is a way to pass options via json, instead of writing all the options every time.
We suggest storing the project file in the root directory of your web project, in order to let other team members run Visitor with ease, by just typing: visitor --project
Tests
All features have been written as global functions to provide an easy way to test them.
Tests are written with phpunit, so to run them type:
phpunit