- класс
HttpResponse
(httpclient\HttpResponse
) - исходники
httpclient/HttpResponse.php
Описание
Class HttpResponse
->
body
:mixed
->
responseCode
:mixed
->
statusMessage
:mixed
->
headers
:mixed
->
cookies
:mixed
->
time
:Time
->
__construct()
- HttpResponse constructor.->
body()
->
statusCode()
->
statusMessage()
->
headers()
->
header()
- Returns header value.->
contentType()
- Returns Content-Type header value.->
contentLength()
- Content-Length header value, returns -1 if it does not exist.->
cookie()
->
cookies()
- Return array of Set-Cookie header.->
isSuccess()
- Check http code >= 200 and <= 399->
isFail()
- Check http code >= 400->
isError()
- Check http code >= 400->
isBadRequest()
- Check http code is 400.->
isAuthRequired()
- Check http code is 401.->
isPaymentRequired()
- Check http code is 402.->
isNotFound()
- Check http code is 404->
isAccessDenied()
- Check http code is 403->
isInvalidMethod()
- Check http code is 405->
isServerError()
- Check http code >= 500->
isServiceUnavailable()
- Check http code is 503.->
time()
- Time of creation response.
__construct(): void
HttpResponse constructor.
body(mixed $data): mixed|string|array|Stream
statusCode([ int $responseCode): int
statusMessage([ string $statusMessage): string
headers([ array $headerFields): array
header(string $name): mixed
Returns header value.
contentType([ string $contentType): string
Returns Content-Type header value.
contentLength([ int $size): int
Content-Length header value, returns -1 if it does not exist.
cookie(string $name): string|array
cookies(array $data): array
Return array of Set-Cookie header.
isSuccess(): bool
Check http code >= 200 and <= 399
isFail(): bool
Check http code >= 400
isError(): bool
Check http code >= 400
isBadRequest(): bool
Check http code is 400.
isAuthRequired(): bool
Check http code is 401.
isPaymentRequired(): bool
Check http code is 402.
isNotFound(): bool
Check http code is 404
isAccessDenied(): bool
Check http code is 403
isInvalidMethod(): bool
Check http code is 405
isServerError(): bool
Check http code >= 500
isServiceUnavailable(): bool
Check http code is 503.
time(): php\time\Time
Time of creation response.