Http
    
            
            in package
            
        
    
    
    
        
            Un sencillo cliente HTTP basado en cURL.
Tags
Table of Contents
- $error : string
 - $body : string
 - $data : mixed
 - $method : string
 - $url : string
 - $curlOptions : array<string|int, mixed>
 - $executed : bool
 - $headers : array<string|int, mixed>
 - $responseHeaders : array<string|int, mixed>
 - $statusCode : int
 - __construct() : mixed
 - body() : string
 - delete() : self
 - errorMessage() : string
 - failed() : bool
 - get() : self
 - header() : string
 - headers() : array<string|int, mixed>
 - json() : mixed
 - notFound() : bool
 - ok() : bool
 - post() : self
 - postJson() : self
 - put() : self
 - saveAs() : bool
 - setBearerToken() : self
 - setCurlOption() : self
 - setHeader() : self
 - setHeaders() : self
 - setTimeout() : self
 - setToken() : self
 - setUser() : self
 - setUserAgent() : self
 - status() : int
 - exec() : void
 - getPostFields() : mixed
 
Properties
$error
    public
        string
    $error
    
    
    
    
$body
    protected
        string
    $body
    
    
    
    
$data
    protected
        mixed
    $data
    
    
    
    
$method
    protected
        string
    $method
    
    
    
    
$url
    protected
        string
    $url
    
    
    
    
$curlOptions
    private
        array<string|int, mixed>
    $curlOptions
    
    
    
    
$executed
    private
        bool
    $executed
     = false
    
    
    
$headers
    private
        array<string|int, mixed>
    $headers
     = []
    
    
    
$responseHeaders
    private
        array<string|int, mixed>
    $responseHeaders
     = []
    
    
    
$statusCode
    private
        int
    $statusCode
     = 0
    
    
    
Methods
__construct()
    public
                    __construct(string $method, string $url[, mixed $data = [] ]) : mixed
        
        Parameters
- $method : string
 - $url : string
 - $data : mixed = []
 
Return values
mixed —body()
    public
                    body() : string
        
    
    
        Return values
string —delete()
    public
            static        delete(string $url[, mixed $data = [] ]) : self
        
        Parameters
- $url : string
 - $data : mixed = []
 
Return values
self —errorMessage()
    public
                    errorMessage() : string
        
    
    
        Return values
string —failed()
    public
                    failed() : bool
        
    
    
        Return values
bool —get()
    public
            static        get(string $url[, mixed $data = [] ]) : self
        
        Parameters
- $url : string
 - $data : mixed = []
 
Return values
self —header()
    public
                    header(string $key) : string
        
        Parameters
- $key : string
 
Return values
string —headers()
    public
                    headers() : array<string|int, mixed>
        
    
    
        Return values
array<string|int, mixed> —json()
    public
                    json([bool $associative = true ]) : mixed
        
        Parameters
- $associative : bool = true
 
Return values
mixed —notFound()
    public
                    notFound() : bool
        
    
    
        Return values
bool —ok()
    public
                    ok() : bool
        
    
    
        Return values
bool —post()
    public
            static        post(string $url[, mixed $data = [] ]) : self
        
        Parameters
- $url : string
 - $data : mixed = []
 
Return values
self —postJson()
    public
            static        postJson(string $url[, array<string|int, mixed> $data = [] ]) : self
        
        Parameters
- $url : string
 - $data : array<string|int, mixed> = []
 
Return values
self —put()
    public
            static        put(string $url[, mixed $data = [] ]) : self
        
        Parameters
- $url : string
 - $data : mixed = []
 
Return values
self —saveAs()
    public
                    saveAs(string $filename) : bool
        
        Parameters
- $filename : string
 
Return values
bool —setBearerToken()
    public
                    setBearerToken(string $token) : self
        
        Parameters
- $token : string
 
Return values
self —setCurlOption()
    public
                    setCurlOption(int $option, mixed $value) : self
        
        Parameters
- $option : int
 - $value : mixed
 
Return values
self —setHeader()
    public
                    setHeader(string $key, string $value) : self
        
        Parameters
- $key : string
 - $value : string
 
Return values
self —setHeaders()
    public
                    setHeaders(array<string|int, mixed> $headers) : self
        
        Parameters
- $headers : array<string|int, mixed>
 
Return values
self —setTimeout()
    public
                    setTimeout(int $timeout) : self
        
        Parameters
- $timeout : int
 
Return values
self —setToken()
    public
                    setToken(string $token) : self
        
        Parameters
- $token : string
 
Return values
self —setUser()
    public
                    setUser(string $user, string $password) : self
        
        Parameters
- $user : string
 - $password : string
 
Return values
self —setUserAgent()
    public
                    setUserAgent(string $userAgent) : self
        
        Parameters
- $userAgent : string
 
Return values
self —status()
    public
                    status() : int
        
    
    
        Return values
int —exec()
    protected
                    exec() : void
        
    
    
        Return values
void —getPostFields()
    protected
                    getPostFields() : mixed