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.
Methods
|
__construct(array $server = array(), History $history = null, CookieJar $cookieJar = null)
Constructor. |
||
|
followRedirects(Boolean $followRedirect = true)
Sets whether to automatically follow redirects or not. |
||
|
insulate(Boolean $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 |
getCrawler()
Returns the current Crawler instance. |
|
| Response |
getResponse()
Returns the current Response instance. |
|
| Request |
getRequest()
Returns the current Request instance. |
|
| Crawler |
click(Link $link)
Clicks on a given link. |
|
| Crawler |
submit(Form $form, array $values = array())
Submits a form. |
|
| Crawler |
request(string $method, string $uri, array $parameters = array(), array $files = array(), array $server = array(), string $content = null, Boolean $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. |
Details
at line 52
public
__construct(array $server = array(), History $history = null, CookieJar $cookieJar = null)
Constructor.
at line 68
public
followRedirects(Boolean $followRedirect = true)
Sets whether to automatically follow redirects or not.
at line 82
public
insulate(Boolean $insulated = true)
Sets the insulated flag.
at line 100
public
setServerParameters(array $server)
Sets server parameters.
at line 114
public
setServerParameter(string $key, string $value)
Sets single server parameter.
at line 127
public string
getServerParameter(string $key, string $default = '')
Gets single server parameter for specified key.
at line 139
public History
getHistory()
Returns the History instance.
at line 151
public CookieJar
getCookieJar()
Returns the CookieJar instance.
at line 163
public Crawler
getCrawler()
Returns the current Crawler instance.
at line 175
public Response
getResponse()
Returns the current Response instance.
at line 187
public Request
getRequest()
Returns the current Request instance.
at line 201
public Crawler
click(Link $link)
Clicks on a given link.
at line 220
public Crawler
submit(Form $form, array $values = array())
Submits a form.
at line 242
public Crawler
request(string $method, string $uri, array $parameters = array(), array $files = array(), array $server = array(), string $content = null, Boolean $changeHistory = true)
Calls a URI.
at line 373
public Crawler
back()
Goes back in the browser history.
at line 385
public Crawler
forward()
Goes forward in the browser history.
at line 397
public Crawler
reload()
Reloads the current browser.
at line 411
public Crawler
followRedirect()
Follow redirects?
at line 427
public
restart()
Restarts the client.
It flushes history and all cookies.