PHP 클래스 Phergie_Plugin_Http, phergie

저자: Phergie Development Team ([email protected])
상속: extends Phergie_Plugin_Abstract
파일 보기 프로젝트 열기: phergie/phergie 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$handlers array Mapping of content types to handlers for them
$response Phergie_Plugin_Http_Response Response to the last executed HTTP request

공개 메소드들

메소드 설명
get ( string $url, array $query = [], array $context = [] ) : Phergie_Plugin_Http_Response Performs a GET request.
handleError ( integer $errno, string $errstr, string $errfile, string $errline ) : boolean Supporting method that acts as an error handler to intercept HTTP responses resulting in PHP-level errors.
head ( string $url, array $query = [], array $context = [] ) : Phergie_Plugin_Http_Response Performs a HEAD request.
onLoad ( ) : void Initializes the handler lookup table.
post ( string $url, array $query = [], array $post = [], array $context = [] ) : Phergie_Plugin_Http_Response Performs a POST request.
request ( string $url, array $context ) : Phergie_Plugin_Http_Response Supporting method that executes a request and handles the response.
setHandler ( string $type, callback $callback ) : Phergie_Plugin_Http Sets a handler callback for a content type, which is called when a response of that content type is received to perform any needed transformations on the response body content before storing it in the response object. Note that the calling plugin is responsible for indicating any dependencies related to specified handler callbacks.

보호된 메소드들

메소드 설명
parseStatusLine ( string $status ) : array Supporting method that parses the status line of an HTTP response message.

메소드 상세

get() 공개 메소드

Performs a GET request.
public get ( string $url, array $query = [], array $context = [] ) : Phergie_Plugin_Http_Response
$url string URL for the request
$query array Optional associative array of parameters constituting the URL query string if $url has none
$context array Optional associative array of additional stream context parameters
리턴 Phergie_Plugin_Http_Response Received response data

handleError() 공개 메소드

Supporting method that acts as an error handler to intercept HTTP responses resulting in PHP-level errors.
public handleError ( integer $errno, string $errstr, string $errfile, string $errline ) : boolean
$errno integer Level of the error raised
$errstr string Error message
$errfile string Name of the file in which the error was raised
$errline string Line number on which the error was raised
리턴 boolean Always returns TRUE to allow normal execution to continue once this method terminates

head() 공개 메소드

Performs a HEAD request.
public head ( string $url, array $query = [], array $context = [] ) : Phergie_Plugin_Http_Response
$url string URL for the request
$query array Optional associative array of parameters constituting the URL query string if $url has none
$context array Optional associative array of additional stream context parameters
리턴 Phergie_Plugin_Http_Response Received response data

onLoad() 공개 메소드

Initializes the handler lookup table.
public onLoad ( ) : void
리턴 void

parseStatusLine() 보호된 메소드

Supporting method that parses the status line of an HTTP response message.
protected parseStatusLine ( string $status ) : array
$status string Status line
리턴 array Associative array containing the HTTP version, response code, and response description

post() 공개 메소드

Performs a POST request.
public post ( string $url, array $query = [], array $post = [], array $context = [] ) : Phergie_Plugin_Http_Response
$url string URL for the request
$query array Optional associative array of parameters constituting the URL query string if $url has none
$post array Optional associative array of parameters constituting the POST request body if it is using the traditional URL-encoded format
$context array Optional associative array of additional stream context parameters
리턴 Phergie_Plugin_Http_Response Received response data

request() 공개 메소드

Supporting method that executes a request and handles the response.
public request ( string $url, array $context ) : Phergie_Plugin_Http_Response
$url string URL to request
$context array Associative array of stream context parameters
리턴 Phergie_Plugin_Http_Response Object representing the response resulting from the request

setHandler() 공개 메소드

Sets a handler callback for a content type, which is called when a response of that content type is received to perform any needed transformations on the response body content before storing it in the response object. Note that the calling plugin is responsible for indicating any dependencies related to specified handler callbacks.
public setHandler ( string $type, callback $callback ) : Phergie_Plugin_Http
$type string PCRE regular expression (without delimiters) that matches one or more MIME types
$callback callback Callback to execute when a response of a content type matched by $type is encountered
리턴 Phergie_Plugin_Http Provides a fluent interface

프로퍼티 상세

$handlers 보호되어 있는 프로퍼티

Mapping of content types to handlers for them
protected array $handlers
리턴 array

$response 보호되어 있는 프로퍼티

Response to the last executed HTTP request
protected Phergie_Plugin_Http_Response $response
리턴 Phergie_Plugin_Http_Response