PHP 클래스 Neos\Flow\Http\Client\Browser

파일 보기 프로젝트 열기: neos/flow-development-collection 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$automaticRequestHeaders Neos\Flow\Http\Headers
$followRedirects boolean If redirects should be followed
$lastRequest Neos\Flow\Http\Request
$lastResponse Neos\Flow\Http\Response
$maximumRedirections integer The very maximum amount of redirections to follow if there is a "Location" redirect (see also $redirectionStack property)
$redirectionStack array A simple string array that keeps track of occurred "Location" header redirections to avoid infinite loops if the same redirection happens
$requestEngine Neos\Flow\Http\Client\RequestEngineInterface

공개 메소드들

메소드 설명
__construct ( ) Construct the Browser instance.
addAutomaticRequestHeader ( string $name, array | string | DateTime $values ) : void Allows to add headers to be sent with every request the browser executes.
getCrawler ( ) : Crawler Returns the DOM crawler which can be used to interact with the web page structure, submit forms, click links or fetch specific parts of the website's contents.
getForm ( string $xpath = '//form' ) : Form Get the form specified by $xpath. If no $xpath given, return the first form on the page.
getLastRequest ( ) : Request Returns the last request executed.
getLastResponse ( ) : Response Returns the response received after the last request.
getRequestEngine ( ) : Neos\Flow\Http\Client\RequestEngineInterface Returns the request engine used by this Browser.
removeAutomaticRequestHeader ( string $name ) : void Allows to remove headers that were added with addAutomaticRequestHeader.
request ( string | Uri $uri, string $method = 'GET', array $arguments = [], array $files = [], array $server = [], string $content = null ) : Response Requests the given URI with the method and other parameters as specified.
sendRequest ( Request $request ) : Response Sends a prepared request and returns the respective response.
setFollowRedirects ( boolean $flag ) : void Sets a flag if redirects should be followed or not.
setRequestEngine ( Neos\Flow\Http\Client\RequestEngineInterface $requestEngine ) : void Inject the request engine
submit ( Form $form ) : Response Submit a form

메소드 상세

__construct() 공개 메소드

Construct the Browser instance.
public __construct ( )

addAutomaticRequestHeader() 공개 메소드

Allows to add headers to be sent with every request the browser executes.
또한 보기: Message::setHeader()
public addAutomaticRequestHeader ( string $name, array | string | DateTime $values ) : void
$name string Name of the header, for example "Location", "Content-Description" etc.
$values array | string | DateTime An array of values or a single value for the specified header field
리턴 void

getCrawler() 공개 메소드

The returned DOM crawler is bound to the response of the last executed request.
public getCrawler ( ) : Crawler
리턴 Symfony\Component\DomCrawler\Crawler

getForm() 공개 메소드

Get the form specified by $xpath. If no $xpath given, return the first form on the page.
public getForm ( string $xpath = '//form' ) : Form
$xpath string
리턴 Symfony\Component\DomCrawler\Form

getLastRequest() 공개 메소드

Returns the last request executed.
public getLastRequest ( ) : Request
리턴 Neos\Flow\Http\Request The HTTP request or NULL if there wasn't a request yet

getLastResponse() 공개 메소드

Returns the response received after the last request.
public getLastResponse ( ) : Response
리턴 Neos\Flow\Http\Response The HTTP response or NULL if there wasn't a response yet

getRequestEngine() 공개 메소드

Returns the request engine used by this Browser.
public getRequestEngine ( ) : Neos\Flow\Http\Client\RequestEngineInterface
리턴 Neos\Flow\Http\Client\RequestEngineInterface

removeAutomaticRequestHeader() 공개 메소드

Allows to remove headers that were added with addAutomaticRequestHeader.
public removeAutomaticRequestHeader ( string $name ) : void
$name string Name of the header, for example "Location", "Content-Description" etc.
리턴 void

request() 공개 메소드

If a Location header was given and the status code is of response type 3xx (see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, 14.30 Location)
public request ( string | Uri $uri, string $method = 'GET', array $arguments = [], array $files = [], array $server = [], string $content = null ) : Response
$uri string | Neos\Flow\Http\Uri
$method string Request method, for example "GET"
$arguments array Arguments to send in the request body
$files array
$server array
$content string
리턴 Neos\Flow\Http\Response The HTTP response

sendRequest() 공개 메소드

Sends a prepared request and returns the respective response.
public sendRequest ( Request $request ) : Response
$request Neos\Flow\Http\Request
리턴 Neos\Flow\Http\Response

setFollowRedirects() 공개 메소드

Sets a flag if redirects should be followed or not.
public setFollowRedirects ( boolean $flag ) : void
$flag boolean
리턴 void

setRequestEngine() 공개 메소드

Inject the request engine
public setRequestEngine ( Neos\Flow\Http\Client\RequestEngineInterface $requestEngine ) : void
$requestEngine Neos\Flow\Http\Client\RequestEngineInterface
리턴 void

submit() 공개 메소드

Submit a form
public submit ( Form $form ) : Response
$form Symfony\Component\DomCrawler\Form
리턴 Neos\Flow\Http\Response

프로퍼티 상세

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

protected Headers,Neos\Flow\Http $automaticRequestHeaders
리턴 Neos\Flow\Http\Headers

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

If redirects should be followed
protected bool $followRedirects
리턴 boolean

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

protected Request,Neos\Flow\Http $lastRequest
리턴 Neos\Flow\Http\Request

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

protected Response,Neos\Flow\Http $lastResponse
리턴 Neos\Flow\Http\Response

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

The very maximum amount of redirections to follow if there is a "Location" redirect (see also $redirectionStack property)
protected int $maximumRedirections
리턴 integer

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

A simple string array that keeps track of occurred "Location" header redirections to avoid infinite loops if the same redirection happens
protected array $redirectionStack
리턴 array

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

protected RequestEngineInterface,Neos\Flow\Http\Client $requestEngine
리턴 Neos\Flow\Http\Client\RequestEngineInterface