Client
class Client extends Client
Client simulates a browser and makes requests to a Kernel object.
Properties
protected | $history | from Client | |
protected | $cookieJar | from Client | |
protected | $server | from Client | |
protected | $internalRequest | from Client | |
protected | $request | from Client | |
protected | $internalResponse | from Client | |
protected | $response | from Client | |
protected | $crawler | from Client | |
protected | $insulated | from Client | |
protected | $redirect | from Client | |
protected | $followRedirects | from Client | |
protected | $followMetaRefresh | from Client | |
protected | $kernel | from Client |
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.
Gets single server parameter for specified key.
No description
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.
Converts the HttpKernel response to a BrowserKit response.
Creates a crawler.
Takes a URI and converts it to absolute if it is not already absolute.
Makes a request from a Request object directly.
Sets whether to catch exceptions when the kernel is handling a request.
Returns the container.
Returns the kernel.
Gets the profile associated with the current Response.
Enables the profiler for the very next request.
Disables kernel reboot between requests.
Enables kernel reboot between requests.
Details
__construct(HttpKernelInterface $kernel, array $server = array(), History $history = null, CookieJar $cookieJar = null)
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)
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.
It assumes that the autoloader is named 'autoload.php' and that it is stored in the same directory as the kernel (this is the case for the Symfony Standard Edition). If this is not your case, create your own client and override this method.
protected object
filterRequest(Request $request)
Converts the BrowserKit request to a HttpKernel request.
protected Response
filterResponse(object $response)
Converts the HttpKernel response to a BrowserKit response.
protected Crawler|null
createCrawlerFromContent(string $uri, string $content, string $type)
Creates a crawler.
This method returns null if the DomCrawler component is not available.
protected string
getAbsoluteUri(string $uri)
Takes a URI and converts it to absolute if it is not already absolute.
protected Crawler
requestFromRequest(Request $request, bool $changeHistory = true)
Makes a request from a Request object directly.
catchExceptions(bool $catchExceptions)
Sets whether to catch exceptions when the kernel is handling a request.
protected array
filterFiles(array $files)
Filters an array of files.
This method created test instances of UploadedFile so that the move() method can be called on those instances.
If the size of a file is greater than the allowed size (from php.ini) then an invalid UploadedFile is returned with an error set to UPLOAD_ERR_INI_SIZE.
enableProfiler()
Enables the profiler for the very next request.
If the profiler is not enabled, the call to this method does nothing.