fgsl / http
Fgsl Http Requester
Installs: 156
Dependents: 3
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 1
Type:component
Requires
- php: >=8.1
- ext-curl: *
- phpunit/phpunit: >=10.0
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.