Skip to content

Check or ping urls for http response/status codes.

License

Notifications You must be signed in to change notification settings

mrethical/url-status

Repository files navigation

URL Status Code Checker

This package can be used to retrieve http status code of a particular url, as well as its headers.

  • Easy to use.
  • Lightweight, no dependencies.
  • Can be configured easily with curl options.

Requirements

This package only requires php curl and json extensions. PHP requirement is 5.4+.

Installation

Add muffeen/url-status as a require dependency in your composer.json file:

composer require muffeen/url-status 

Usage

Refer to the example below:

use Muffeen\UrlStatus\UrlStatus;

$urlStatus = UrlStatus::get('http://www.example.com');
$httStatusCode = $urlStatus->getStatusCode();
$responseHeaders = $urlStatus->getResponseHeaders();

Extend your request by using curl options constants. The example below show how can you set a user agent for your request.

use Muffeen\UrlStatus\UrlStatus;

$urlStatus = UrlStatus::get('http://www.example.com', array(
    CURLOPT_USERAGENT => '<user-agent-here>',
));
$httStatusCode = $urlStatus->getStatusCode();
$responseHeaders = $urlStatus->getResponseHeaders();

License

This package is open-sourced software licensed under the MIT license.

About

Check or ping urls for http response/status codes.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages