PHP Class ProxyRequest, vanilla

This class abstracts the work of doing external requests.
Since: 2.0.18
Author: Tim Gunter ([email protected])
显示文件 Open project: vanilla/vanilla Class Usage Examples

Public Properties

Property Type Description
$ActionLog
$ConnectionMode
$ContentLength
$ContentType
$MaxReadSize
$ParsedBody
$RequestBody
$RequestDefaults
$RequestHeaders
$ResponseBody
$ResponseHeaders
$ResponseStatus
$ResponseTime

Protected Properties

Property Type Description
$CookieJar
$FileTransfer
$Options
$SaveFile
$UseSSL

Public Methods

Method Description
__construct ( boolean $Loud = false, array $RequestDefaults = null ) : type Set up ProxyRequest.
__destruct ( )
body ( ) : mixed
clean ( )
curlHeader ( &$Handler, $HeaderString ) : integer
headers ( ) : mixed
request ( $Options = null, array $QueryParams = null, array $Files = null, array $ExtraHeaders = null ) : type Send a request and receive the response.
responseClass ( string $Class ) : boolean Check if the provided response matches the provided response type
status ( ) : mixed
time ( ) : float Get request total time

Protected Methods

Method Description
action ( $Message, null $Loud = null )
curlReceive ( &$Handler ) : mixed | string

Method Details

__construct() public method

Options: URL Host Method ConnectTimeout Timeout Redirects Cookies SaveAs CloseSession Redirected Debug Simulate
public __construct ( boolean $Loud = false, array $RequestDefaults = null ) : type
$Loud boolean
$RequestDefaults array
return type

__destruct() public method

public __destruct ( )

action() protected method

protected action ( $Message, null $Loud = null )
$Message
$Loud null

body() public method

public body ( ) : mixed
return mixed

clean() public method

public clean ( )

curlHeader() public method

public curlHeader ( &$Handler, $HeaderString ) : integer
$Handler
$HeaderString
return integer

curlReceive() protected method

protected curlReceive ( &$Handler ) : mixed | string
$Handler
return mixed | string

headers() public method

public headers ( ) : mixed
return mixed

request() public method

Options: 'URL' => NULL, 'Host' => NULL, // Override the Host: header 'Method' => 'GET', // HTTP Method 'ConnectTimeout' => 5, // Connection timeout 'Timeout' => 5, // Request timeout 'TransferMode' => 'normal', // or 'binary' 'SaveAs' => NULL, // Download the response to this file 'Redirects' => TRUE, // Allow 302 and 302 redirects 'SSLNoVerify' => FALSE, // Verify the remote SSL cert 'PreEncodePost' => TRUE, // 'Cookies' => TRUE, // Send user's browser cookies? 'CookieJar' => FALSE, // Create a cURL CookieJar? 'CookieSession' => FALSE, // Should old cookies be trashed starting now? 'CloseSession' => TRUE, // Whether to close the session. Should always do this. 'Redirected' => FALSE, // Is this a redirected request? 'Debug' => FALSE, // Debug output 'Simulate' => FALSE // Don't actually request, just set up
public request ( $Options = null, array $QueryParams = null, array $Files = null, array $ExtraHeaders = null ) : type
$QueryParams array GET/POST parameters
$Files array List of files to upload
$ExtraHeaders array Any additional headers to tack on
return type

responseClass() public method

Class is a string representation of the HTTP status code, with 'x' used as a wildcard. Class '2xx' = All 200-level responses Class '30x' = All 300-level responses up to 309
public responseClass ( string $Class ) : boolean
$Class string
return boolean Whether the response matches or not

status() public method

public status ( ) : mixed
return mixed

time() public method

Get request total time
public time ( ) : float
return float

Property Details

$ActionLog public_oe property

public $ActionLog

$ConnectionMode public_oe property

public $ConnectionMode

$ContentLength public_oe property

public $ContentLength

$ContentType public_oe property

public $ContentType

$CookieJar protected_oe property

protected $CookieJar

$FileTransfer protected_oe property

protected $FileTransfer

$MaxReadSize public_oe property

public $MaxReadSize

$Options protected_oe property

protected $Options

$ParsedBody public_oe property

public $ParsedBody

$RequestBody public_oe property

public $RequestBody

$RequestDefaults public_oe property

public $RequestDefaults

$RequestHeaders public_oe property

public $RequestHeaders

$ResponseBody public_oe property

public $ResponseBody

$ResponseHeaders public_oe property

public $ResponseHeaders

$ResponseStatus public_oe property

public $ResponseStatus

$ResponseTime public_oe property

public $ResponseTime

$SaveFile protected_oe property

protected $SaveFile

$UseSSL protected_oe property

protected $UseSSL