PHP Класс Restagent\Request

For full disclosure this is a shameless rip-off from: https://github.com/inadarei/settee/blob/master/src/classes/ZaphpaRestClient.class.php That is: if you can call "stealing" from one's self "shameless" :)
Показать файл Открыть проект

Открытые методы

Метод Описание
__construct ( null $base_url = '' ) Public constructor
__destruct ( ) Class destructor cleans up any resources
content_mime_type ( $content ) : void
data ( ) Set a variable (query param or a data var)
delete ( $uri ) HTTP DELETE
file_mime_type ( $path ) : void
get ( $uri ) HTTP GET
head ( $uri ) HTTP HEAD
header ( ) Set an HTTP Head
method ( $method ) : Request Set HTTP method to use with send()
param ( ) Set a query param. This method can/should not be used with HTTP GET! Use var() call instead or you will get an exception
post ( $uri ) HTTP POST
put ( $uri ) HTTP PUT
send ( $uri ) Custom HTTP Method. Use with caution.
timeout ( $ms ) Set curl/http timeout in milliseconds.

Приватные методы

Метод Описание
_http_parse_headers ( $header ) : array Backup PHP impl. for when PECL http_parse_headers() function is not available
check_status ( $response, $full_url ) Check http status for safe return codes
get_full_url ( $uri ) Get full URL from a partial one
http_request ( $http_method, $uri, array $data = [] ) Generic implementation of a HTTP Request.

Описание методов

__construct() публичный Метод

Public constructor
public __construct ( null $base_url = '' )
$base_url null

__destruct() публичный Метод

Class destructor cleans up any resources
public __destruct ( )

content_mime_type() публичный Метод

public content_mime_type ( $content ) : void
$content content of a file in a string buffer format.
Результат void

data() публичный Метод

Set a variable (query param or a data var)
public data ( )

delete() публичный Метод

HTTP DELETE
public delete ( $uri )

file_mime_type() публичный Метод

public file_mime_type ( $path ) : void
$path Full path to a file (e.g. as returned by PHP's realpath function).
Результат void

get() публичный Метод

HTTP GET
public get ( $uri )

head() публичный Метод

HTTP HEAD
public head ( $uri )

header() публичный Метод

Set an HTTP Head
public header ( )

method() публичный Метод

Set HTTP method to use with send()
public method ( $method ) : Request
$method
Результат Request

param() публичный Метод

Set a query param. This method can/should not be used with HTTP GET! Use var() call instead or you will get an exception
public param ( )

post() публичный Метод

HTTP POST
public post ( $uri )

put() публичный Метод

HTTP PUT
public put ( $uri )

send() публичный Метод

Custom HTTP Method. Use with caution.
public send ( $uri )
$uri

timeout() публичный Метод

Set curl/http timeout in milliseconds.
public timeout ( $ms )
$ms