spaze / url-checker
A command line tool to check URL HTTP code and contents.
Installs: 20
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:project
pkg:composer/spaze/url-checker
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^12.0 || ^13.0
- spaze/coding-standard: ^1.9
- spaze/phpcs-phar: ^4.0
README
A command line tool to check URL HTTP code and contents.
Install
composer create-project --no-dev spaze/url-checker url-checker
Usage
check.php <url> <expected_http_code> <required_text> <forbidden_text> [OPTIONS]
Options
--ignore-case-required-text: Ignore case when looking for the required text. Only ASCII case folding will be done, non-ASCII bytes will be compared by their byte value.--ignore-case-forbidden-text: Ignore case when looking for the forbidden text. Only ASCII case folding will be done, non-ASCII bytes will be compared by their byte value.
The checker sends a request to <url> and checks:
- If the HTTP status code matches
<expected_http_code> - If the page contains
<required_text> - If
<forbidden_text>is not present
Example
bin/check.php https://example.com 200 "required" "FAiLuRe" --ignore-case-forbidden-text
Exit codes
The exit code is
1if the status code doesn't match<expected_http_code>2if<required_text>is missing3if<forbidden_text>is found4if other runtime error occurs