class Client extends Client
Client simulates a browser and makes requests to a Kernel object.
Methods
__construct(HttpKernelInterface $kernel, array $server = array(), History $history = null, CookieJar $cookieJar = null) Constructor. | ||
followRedirects(bool $followRedirect = true) Sets whether to automatically follow redirects or not. | from Client | |
bool | isFollowingRedirects() Returns whether client automatically follows redirects or not. | from Client |
setMaxRedirects(int $maxRedirects) Sets the maximum number of requests that crawler can follow. | from Client | |
int | getMaxRedirects() Returns the maximum number of requests that crawler can follow. | from Client |
insulate(bool $insulated = true) Sets the insulated flag. | from Client | |
setServerParameters(array $server) Sets server parameters. | from Client | |
setServerParameter(string $key, string $value) Sets single server parameter. | from Client | |
string | getServerParameter(string $key, string $default = '') Gets single server parameter for specified key. | from Client |
History | getHistory() Returns the History instance. | from Client |
CookieJar | getCookieJar() Returns the CookieJar instance. | from Client |
Crawler|null | getCrawler() Returns the current Crawler instance. | from Client |
Response|null | getInternalResponse() Returns the current BrowserKit Response instance. | from Client |
object|null | getResponse() Returns the current origin response instance. | from Client |
Request|null | getInternalRequest() Returns the current BrowserKit Request instance. | from Client |
object|null | getRequest() Returns the current origin Request instance. | from Client |
Crawler | click(Link $link) Clicks on a given link. | from Client |
Crawler | submit(Form $form, array $values = array()) Submits a form. | from Client |
Crawler | request(string $method, string $uri, array $parameters = array(), array $files = array(), array $server = array(), string $content = null, bool $changeHistory = true) Calls a URI. | from Client |
Crawler | back() Goes back in the browser history. | from Client |
Crawler | forward() Goes forward in the browser history. | from Client |
Crawler | reload() Reloads the current browser. | from Client |
Crawler | followRedirect() Follow redirects? | from Client |
restart() Restarts the client. | from Client | |
ContainerInterface|null | getContainer() Returns the container. | |
KernelInterface | getKernel() Returns the kernel. | |
Profile | getProfile() Gets the profile associated with the current Response. | |
enableProfiler() Enables the profiler for the very next request. | ||
disableReboot() Disables kernel reboot between requests. | ||
enableReboot() Enables kernel reboot between requests. |
Details
__construct(HttpKernelInterface $kernel, array $server = array(), History $history = null, CookieJar $cookieJar = null)
Constructor.
followRedirects(bool $followRedirect = true)
Sets whether to automatically follow redirects or not.
bool isFollowingRedirects()
Returns whether client automatically follows redirects or not.
setMaxRedirects(int $maxRedirects)
Sets the maximum number of requests that crawler can follow.
int getMaxRedirects()
Returns the maximum number of requests that crawler can follow.
insulate(bool $insulated = true)
Sets the insulated flag.
setServerParameters(array $server)
Sets server parameters.
setServerParameter(string $key, string $value)
Sets single server parameter.
string getServerParameter(string $key, string $default = '')
Gets single server parameter for specified key.
History getHistory()
Returns the History instance.
CookieJar getCookieJar()
Returns the CookieJar instance.
Crawler|null getCrawler()
Returns the current Crawler instance.
Response|null getInternalResponse()
Returns the current BrowserKit Response instance.
object|null getResponse()
Returns the current origin response instance.
The origin response is the response instance that is returned by the code that handles requests.
Request|null getInternalRequest()
Returns the current BrowserKit Request instance.
object|null getRequest()
Returns the current origin Request instance.
The origin request is the request instance that is sent to the code that handles requests.
Crawler request(string $method, string $uri, array $parameters = array(), array $files = array(), array $server = array(), string $content = null, bool $changeHistory = true)
Calls a URI.
Crawler back()
Goes back in the browser history.
Crawler forward()
Goes forward in the browser history.
Crawler reload()
Reloads the current browser.
Crawler followRedirect()
Follow redirects?
restart()
Restarts the client.
It flushes history and all cookies.
ContainerInterface|null getContainer()
Returns the container.
KernelInterface getKernel()
Returns the kernel.
Profile getProfile()
Gets the profile associated with the current Response.
enableProfiler()
Enables the profiler for the very next request.
If the profiler is not enabled, the call to this method does nothing.
disableReboot()
Disables kernel reboot between requests.
By default, the Client reboots the Kernel for each request. This method allows to keep the same kernel across requests.
enableReboot()
Enables kernel reboot between requests.
Please login to continue.