fgsl/http

Fgsl Http Requester

Installs: 86

Dependents: 3

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 0

Open Issues: 1

Type:component

1.4.1 2023-06-15 17:54 UTC

This package is auto-updated.

Last update: 2024-04-15 19:29:38 UTC


README

composer require fgsl/http

Run command:

composer install

For getting Composer: https://getcomposer.org/download/

Run unit tests

phpunit --bootstrap tests/bootstrap.php tests/Fgsl/Test/TestSuite.php

How to use

See below a sample of method request.

use Fgsl\Http\Http;

$ctx = Http::getContext('GET', null);
@$response = Http::request("http://www.horalegalbrasil.mct.on.br/SincronismoPublico.html", $ctx);
        
$this->assertStringContainsString('Sincronismo', $response);

The variable $ctx receives a HTTP context, that is a resource with elements of HTTP protocol.

The variable $response receives HTTP response text, according context defined by $ctx.

Sometimes method request may not work. Then you can use method curl.

See ApiTest class for more examples.