Client
abstract class Client
Client simulates a browser.
To make the actual request, you need to implement the doRequest() method.
If you want to be able to run requests in their own process (insulated flag), you need to also implement the getScript() method.
Properties
Methods
No description
Sets whether to automatically follow redirects or not.
Sets whether to automatically follow meta refresh redirects or not.
Returns whether client automatically follows redirects or not.
Sets the maximum number of redirects that crawler can follow.
Returns the maximum number of redirects that crawler can follow.
Sets the insulated flag.
Sets server parameters.
Sets single server parameter.
Gets single server parameter for specified key.
No description
Returns the History instance.
Returns the CookieJar instance.
Returns the current Crawler instance.
Returns the current BrowserKit Response instance.
Returns the current origin response instance.
Returns the current BrowserKit Request instance.
Returns the current origin Request instance.
Clicks the first link (or clickable image) that contains the given text.
Finds the first form that contains a button with the given content and uses it to submit the given form field values.
Calls a URI.
Makes a request in another process.
Makes a request.
Returns the script to execute when the request must be insulated.
Filters the origin response to the BrowserKit one.
Creates a crawler.
Follow redirects?
Restarts the client.
Takes a URI and converts it to absolute if it is not already absolute.
Makes a request from a Request object directly.
Details
followMetaRefresh(bool $followMetaRefresh = true)
Sets whether to automatically follow meta refresh redirects or not.
string
getServerParameter(string $key, string $default = '')
Gets single server parameter for specified key.
Crawler
xmlHttpRequest(string $method, string $uri, array $parameters = array(), array $files = array(), array $server = array(), string $content = null, bool $changeHistory = true)
object
getResponse()
Returns the current origin response instance.
The origin response is the response instance that is returned by the code that handles requests.
object
getRequest()
Returns the current origin Request instance.
The origin request is the request instance that is sent to the code that handles requests.
Crawler
clickLink(string $linkText)
Clicks the first link (or clickable image) that contains the given text.
Crawler
submitForm(string $button, array $fieldValues = array(), string $method = 'POST', array $serverParameters = array())
Finds the first form that contains a button with the given content and uses it to submit the given form field values.
Crawler
request(string $method, string $uri, array $parameters = array(), array $files = array(), array $server = array(), string $content = null, bool $changeHistory = true)
Calls a URI.
protected
getScript(object $request)
Returns the script to execute when the request must be insulated.
protected Response
filterResponse(object $response)
Filters the origin response to the BrowserKit one.
protected Crawler|null
createCrawlerFromContent(string $uri, string $content, string $type)
Creates a crawler.
This method returns null if the DomCrawler component is not available.